Problem with clilib.php File during Install

Re: Problem with clilib.php File during Install

by Philip Bentley -
Number of replies: 16

I was using the SSH commands and cd into the cli folder. then ran sudo -u nobody php install.php

In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Your command line PHP is probably broken. 

It looks like CLI PHP is actually running the web variety instead. What happens if you run...

php -v
In reply to Howard Miller

Re: Problem with clilib.php File during Install

by Philip Bentley -

Attached is a copy of the Terminal response to php -v command. Server identifying information has been edited out for security, all else remains the same.

Attachment Php -V.PNG
In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Ken Task -
Picture of Particularly helpful Moodlers

Assuming Linux ... what flavor?

What does 'which php' show?

I also see 'public_html' ... might be a VPS configured pretty much like 'shared' servers and OP has to figure out what's missing or where things are located ... like multiple versions of PHP and cli support for PHP.

'spirit of sharing', Ken


In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

This is a VPS the installation will be hosted on. The server status page shows CentOS 6.4 x86_64 as the flavor of linux. I am installing moodle in the public_html directory in a moodle sub-dir. The location is home/(username of account with host)/public_html/moodle.


In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Ken Task -
Picture of Particularly helpful Moodlers

IF the VPS is a dedicated server just to you ... you are the only client on that VPS ... you should have full run at the server.    Typically, 'user space' in apache (the /home/[username]/public_html/ is restricted and not like apache's true web document root located at /var/www/html and the 'home' directory for the apache user which in CentOS 6 is 'apache' which is /var/www/

Use of the sudo command .... should NOT be using user 'nobody' in the command.

After logging onto your server as user, issue the following command:

sudo -s

(the -s means stay as root user).

You will be prompted to provide the same password for your user account access.

Your prompt will change to 'root'.

Now change into the location of the moodlecode/admin/cli/

and issue: php install.php

See if that gets by ....

Now since you are using root, all files/folders ownerships/permissions shouldn't restrict.

After finishing, check the ownership/permissions on all files/folders in /home/[username]/public_html/moodle/

There could be other tweaks needed due to /home/ user restrictions.

In all honesty, with CentOS 6, think you'd be better off sudo -s and use /var/www/html/ for the location of the git acquired moodle code and /var/www/ for the location of moodledata directory - that's *IF* your VPS is set up that way.

Something else about CentOS 6 ... in 2020 (which is only 2 years away) CentOS 6 will no longer be getting OS updates.   For future/longer use might check into CentOS 7

https://wiki.centos.org/About/Product

Because there is no OS upgrade directly in CentOS 6 to CentOS 7 ... it means a new instance.

'spirit of sharing', Ken


In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

Thank you for the thorough reply!

So I am admittedly new to Linux server management and was trying to follow the instructions on the moodle install page carefully. When I checked the apache web user I thought I got the response nobody. This could easily have been my mistake.

I do have full root access in SSH to the server and was running the install to the public_html folder because of my inexperience. 

I have requested my VPS host upgrade our server to CentOS 7 per your recommendation so will pause moodle installation until the server has been updated. This will be a fresh install so there is no point in continuing until the new OS is up.

I did test cd into var/www/html folder to confirm this was how the server was set up and that directory existed. 

I will update you on progress once I resume!


Thanks again,

Philip 

In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Mike Hall -

PHP Notices and even Warnings aren't usually show-stoppers in themselves, but the final Fatal error definitely is.

Howard Miller is right, that doesn't look like CLI output. The STDOUT constant should be defined in a CLI context.

Try Howard's suggestion, and maybe this one, which should include something like php-cli:

 rpm -qa | grep php
This command will list all installed PHP packages and might confirm that some others are missing as well.
In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

Update incoming:

     So following your advice I updated to CentOS 7. I got moodle installed and through the command line installation only to be met with the message in the accompanying screenshot. I am working through it now as it appears I just need to install and enable some PHP extensions... Easier said then done though.


Thanks for the help,

Philip

Attachment PHPExtensions.PNG
In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Philip Bentley -

I updated php extensions, deleted the config.php file from moodle directory, and then reran php install.php from admin/cli. It now says installation completed successfully. However when I go to the web address http://xxx.xxx.xxx.xxx/moodle it says this page is not working?

In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Ken Task -
Picture of Particularly helpful Moodlers

When one has to install extensions missing, after installation, apache must be restarted for it to know of the new installation of extensions.

Did you restart apache?

man systemd  .... should show you the manual on systemd.

Double check that you have all the php extensions needed to run a Moodle.

php -m will list

compare with what you find via command above with what  is on https://docs.moodle.org/35/en/PHP

in your moodle code directory, do you have a config.php file?   If not, moodle has not been installed.

If you have the DB for moodle in place ... moodle install will not create the DB for you.   And if you have a moodledata in /var/www/ with ownership/permisions set correctly, then run the admin/cli/install.php script as root.

Please review:

https://docs.moodle.org/35/en/Administration_via_command_line

remember, you are root so you don't have to use sudo.

Execute the interactive commands ... simplist ... that will prompt you for values/info it needs to install.

'spirit of sharing', Ken



In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

I believe the Moodle installation went off without a hitch this time around, attached is a copy of the final message.

Attachment MoodleSuccess.PNG
In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Ken Task -
Picture of Particularly helpful Moodlers

Don't understand when you say 'page is not working' .... is that what it says?  Literally?


In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

I have attached a screenshot of what the page says when I try to load it. I am not knowledgeable when it comes to VPS's but my provider is telling me that it should be in the usr/public_html folder. The VPS provider forced me to get a domain name with the hosting so maybe they have it locked down where web traffic can not access var/www/html? This is just a thought though.

Attachment PageNotWorking.PNG
In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

This will be my last reply for the day as I am about to be off work. Attached is the conversation I had with my VPS provider support chat. Let me know if you think reinstalling to the public_html is the way to go. I am thinking trying again there but using root user to run the php install.php command will solve all issues. Worth a shot anyway.

Attachment conversation.PNG
In reply to Ken Task

Re: Problem with clilib.php File during Install

by Philip Bentley -

I have gotten it working. Moving it to the public_html folder as suggested by my provider, along with installing through the browser instead of the command prompt fixed everything. I do not know why but when I tried installing through the terminal the site became unavailable after the database tables were created.


You have been incredibly helpful so thank you for everything!

Great learning experience for me,

Philip

In reply to Philip Bentley

Re: Problem with clilib.php File during Install

by Ken Task -
Picture of Particularly helpful Moodlers

All is well that ends well, I guess.   Seems to me that your provider has their way of doing things where 'one size fits' all .... makes it easier for them to support ... but they say they don't support customer apps.   VPS, to me, has always meant full run of the box.  Guess they don't see it that way.   Hmmmmmm.

If you get curious one day, see if there is a /etc/httpd/conf/httpd.conf file and see what it contains.

When you say you installed via Web, did you use some sort of button in cPanel to install?

Question: who is provider?

'spirit of sharing', Ken