I've encountered lots of problem when trying to upgrade my PHP from 7.0 to 7.2, I will describe what problems I am having as best as I can, not a native speaker, please bear with my English.

My server is Ubuntu16.04, running apache2 and mysql5.7.

First of all, if PHP7.2 runs under FastCGI, and Apache's PHP7.2 module is enabled, PHP files will get downloaded. Through some search, I found out if I commented out RemoveHandler .php and php_admin_value engine Off in apache configuration, PHP files will go back to being executed. However, the folders under my document root became "unwritable" to user www-data, which causes the website to malfunction. I've checked folders' Mod, they are all either 644 or 755 as normal, also www-data belongs to the right user group. A detail I think worths to mention is that when I check PHP information from front-end, its handler shows Apache instead of FastCGI. If I switch PHP exec mode to Apache, the unwritable problem will still be there. After hours of fighting with this issue, I happened to switch Apache's PHP module back to PHP7.0, to my surprise, everything backs to normal, now I don't have to comment out those 2 directives mentioned above, and every folders are writable for www-data again. And PHP information from front-end shows that PHP is running under 7.2, and its handler fastCGI. But this feels very weird, PHP7.2 is running under FastCGI, why does it need Apache's PHP7.0 module to function correctly? I feel like I probably missed some important module for Apache's PHP7.2, and it has to use PHP7.0's module to carry out its task. But where do I start with to find out what is missing? It is too late now, tomorrow I will add screenshots of my enabled modules and PHP info.


My enabled Apache modules: enter image description here

My PHP Moduels enter image description here

  • One idea is to create php file with the following content: <?php phpinfo(); ?>. Then access the file via a browser and compare the output when php7.0 is andabled and when it is disabled. Also you can compare the two php.ini files located in /etc/php/{7.0,7.2}/apache2. Respectively you can compare the enabled php modules, located under /etc/php/{7.0,7.2}/apache2/conf.d. – pa4080 Feb 11 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.