Php upgrade

Php upgrade

by Alexander Pons -
Number of replies: 4

I have moodle3.5 running with php 7.0, now I want to upgrade to moodle3.9, but I need to upgrade my php, installed php7.4, but when I add to the config.php file the line phpinfo(); it indicates that it is using php7.0. How do have moodle and apache to use php7.4 as every time I start and run moodle3.9 I get the error "error/generalexceptionmessage". I am assuming the error is attributed to the use of php7.0 instead of a higher version. 

So how to I have apache and moodle to use php7.4 when I have both 7.0 and 7.4 installed on the same machine

Thank you for any assistance 


Average of ratings: -
In reply to Alexander Pons

Re: Php upgrade

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I have always found that you need to uninstall the old version and then restart apache to get it to take.
Average of ratings: Useful (1)
In reply to Alexander Pons

Re: Php upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Huh? "... add to the config.php file the line phpinfo(); ..."

phpinfo should be in a small php file ... not added to config.php for Moodle.

Here's one hosting providers 'how 2' ..

https://www.hostinger.com/tutorials/how-to-create-phpinfo-file

Many providers that offer cPanel for customers, that has an app called 'Easy Apache' ... which is really for setting php version you desire to run for a domain.  IF you are hosted such, consult with hosting providers docs/how 2's etc.  cause not all providers use cPanel/Easy Apache.

If, you have command line access, one could check php via commands of php -i (shows how initialized) and php -m (shows what modules/extensions are loaded ... but that is php-cli ... which should match the php version used for the web.

phpinfo file at code root of domain should tell ya.

'SoS', Ken

In reply to Alexander Pons

Re: Php upgrade

by Ken Task -
Picture of Particularly helpful Moodlers

Just for grins, I added: phpinfo(); to the config.php file of a 3.9.highest site
that is functioning just fine.

Then viewed via browser ...

php info showed first ... not moodle default home page and at the very
bottom of the PHP info, this displayed by moodle.

error/An error occurred whilst communicating with the server

Is that what you see with your site?

IF so ... remove the phpinfo(); line from config.php.

Do not need to restart services, just access site with browser.

If you did insert debug lines correctly, one should see something!!!

'SoS', Ken

Average of ratings: Useful (1)