Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Robert Brock -
Number of replies: 8

I'm trying to take our site from Moodle 3.1 to Moodle 3.2. In doing the pre-flight Environment Server Checks for 3.2, I get green lights across the board and PHP is properly recognized as being at PHP 7.0.33. Looking at Server > PHP Info, it also confirms PHP 7.0.33 as being recognized. 

When I go to trigger the upgrade the only thing that displays on the webpage is "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version 5.4.45)" and I'm unable to move forward with the upgrade.

We were running 5.4.45 when I started my version "march" at Moodle 2.7. Is there something else that Moodle's hanging on to think that PHP 5.4.45 is still running?

Thanks!


Average of ratings: -
In reply to Robert Brock

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Are you using the command line installer?
In reply to Howard Miller

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Robert Brock -
I was not using the command line installer. Just going back to the site/admin page as I've done before with previous upgrades. While I wouldn't say that I'm comfortable in the command line, I do have access to terminal in our cPanel and have been able to successfully run scripts via CLI. I'll do some research and give installing from there a try.
In reply to Robert Brock

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Robert Brock -
Ok, I was able to use CLI to install 3.2. Everything looked good in terminal and it indicated that the installation was successful, however when going to the website the only thing that is displayed is the message "Moodle 3.2 or later requires at least PHP 5.6.5 (currently using version 5.4.45)". Trying to back down to Moodle 3.1 results in a message indicating "ERROR!!! The code you are using is OLDER than the version that made these databases!". This is understandable and further confirms that the 3.2 upgrade via CLI was successful. Not sure where to go from here as before performing the upgrade, everything in the Environment Server checks and PHP Info page indicated that PHP 7.0.33 was being recognized and I had nothing but green lights when checking compatibility with a 3.2 upgrade. Any ideas?
In reply to Robert Brock

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Ken Task -
Picture of Particularly helpful Moodlers

You've not mentioned where you host.  What provider?  Does your provider have any docs/tutorials for setting PHP version per domain/etc?

php is really in 2 'parts' ... php-cli (command line) and the php that runs the web interface.  Your cPanel should have some sort of app/icon to set php per directory ... might be called 'Easy Apache' or something similar, depending upon where you host.   Thus back to the top of this response!

(ever feel like one is going in circles? :|   It's OK ... been there myself! Takes some time and tinkering to get oriented.   Just don't give up!!!)

'SoS', Ken


In reply to Ken Task

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Robert Brock -
Thanks Ken. I shall fight! TMD is hosting our dedicated machine. In cPanel used MultiPHP Manager to assign PHP 7.0.33 to the sites domain. That seemed to make Moodle's systems checks and PHP Info happy as it was properly reporting that indeed PHP7.0.33. However, I just performed this little operation as expressed in the Moodle PHP info page.
-------
Displaying phpinfo outside of Moodle
To view the phpinfo information:

Create a file called info.php using your text editor, containing this single line: <?php phpinfo(); ?> Save this file as info.php
Upload this file into the root web accessible folder on your server.
Now open this file in your browser. For example http:///info.php.
-------

Upon running this it reports that PHP 4.4.5 is active. I would seem that the setting changes in MultiPHP Manager didn't take effect, but again, Moodle's was verifying the change to PHP7.033 in the server checks and PHP Info pages. Note that 4.4.5 is the version of PHP that I see when I look at the server settings within the General Information area of cPanel. Thoughts?
In reply to Robert Brock

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Ken Task -
Picture of Particularly helpful Moodlers

Yikes!  PHP 4.4.5 Really??!!!!   That's ancient ... maybe even older than me!!!

PHP info page will show what MultiPHP sets directory to for web.

That does NOT also set php-cli for that Directory.

You have to find the desired php-cli version path to run php-cli scripts that match phpinfo.

So ... in terminal ... cd /path/to/code/

Type: env [ENTER]

Looking for a line defining $PATH ...

The php-cli version you need to run is somewhere along that path.

Copy path line to a text document on local computer to have and shared back here ... so we can cuss/discuss.

Another command to execute:

which php

That should show a path to the php-cli.

Test ... use full/path seen above then add php -v [ENTER]

IF you don't see in first line of that the php-cli and the version you want then we have some more cussin' and dicussion to do! :|

Also ... for your reading 'displeasure' ...

https://www.tmdhosting.com/kb/question/php-version-change/

https://www.tmdhosting.com/kb/category/php-related-questions/

'SoS', Ken


In reply to Ken Task

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Robert Brock -
Thanks Ken for your help... again! wink

I had put in a ticket with TMD on this and they resolved the problem. Here's what they had to say:

-----
"We have reviewed your concern and it seems that you had multiple custom php.ini and .user.ini files with different PHP Directives applied in it, that were overwriting the settings of the main php.ini file on the server, which was the cause of the issue. We have removed them and now your website is properly fetching the correct PHP 7.0 Version that you have selected for it,
------

PS: Ken, I just use CLI to successfully convert all of my database tables to use utf8mb4. Thanks for helping me get over my CLAS!
Average of ratings: Useful (2)
In reply to Robert Brock

Re: Moodle 3.1 to 3.2 Upgrade - Proper PHP Version Running but not Recognized

by Ken Task -
Picture of Particularly helpful Moodlers

Very good!  Now we know how TMD hosting handles multple PHP's.

And congrats!  You've graduated from CLAS! smile

'SoS', Ken