1

I compiled and install PHP7.1.7 from source on Ubuntu16. I followed this tutorial: http://www.shaunfreeman.name/installing-php-7-on-ubuntu-16-04/

I followed it upto the place he adds something to the modules.ini files.

Now, Apache was not loading any php, so I installed

sudo apt-get install libapache2-mod-php

Now apache loaded PHP, but the versions were different, and also did not have the PDO drivers I compiled with. I checked this using phpinfo()

Apache showed 7.0.18, while I installed 7.1.7. I don't know how this second version got installed (perhaps libapache2-mod-php ?)

Also the php executable in /usr/bin was 7.0.18, so I deleted that and created a symlink to my 7.1.7, so at least in the terminal the php works with the correct version.

I need to make Apache to work with this new version.

Things tried:

  • Many other answers(like this one) on the same issue said that I just needed to load the different module in my apache2 config. But I cannot find a module on my system that relates to the php7.1.7. I do have a php7.0, and I believe that is what apache is loading.
0

There are two ways to execute php files from apache: using a module (which is what installing the mod_php package gives you. If you want to do that, you need to edit your httpd.conf file and load the correct module. I would recommend uninstalling the packaged version if you want your compiled version to reduce confusion.

Usually the output from "make install" in the php compilation directory will give you instructions on adding the module to the apache config.

On the other hand, the page you referenced is discussing the second method of using PHP: as an external process (in this case, using FPM). You need configure apache to talk to this external process.

Searching for "apache php fpm" in your favorite browser should yield a number of tutorials on the apache configuration needed (note: you will also see configuration examples for nginx; the configuration files for apache and nginx are not interchangeable, so make sure you're looking at the right thing).

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.