I'm having trouble when installing an older version of PHP (5.1) on a Ubuntu machine. I've tried to downgrade it without success using apt-get, so I tried to install from source. After the installation, typing php -v in the terminal results in the correct version (i.e. 5.1), but the version that apache uses keep the same (the older one: 5.4) if I view it through <?php phpinfo().

How do I add the installation I just did to apache in place of the older one? I need to remove the older version and make apache recognize the version I just installed.


You will have to use the older version's so files in apache's confs, and restart apache for it to take effect. On Ubuntu 14.04, see /etc/apache2/mods-available/php5.load:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Update above line in the file to point to the equivalent so for php 5.1.

  • How do I find the path for the new version installed from source? – Keyne Viana Feb 19 '15 at 18:24
  • That would depend on what flags you used to build PHP. Perhaps a build path or directory to build in? Look in that directory for a .so file. It may have a different name in PHP 5.1. – KM. Feb 19 '15 at 19:42

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.