I need to upgrade to a higher version of php. My current version is 5.1.6.

So I am trying to upgrade php to version 5.3.26.

php installed just fine in /usr/local.

But at least according to wordpress, apache is still seeing the older version of php.

The .bashrc and .bash_profile have been modified for root to point to /usr/local/bin first (where the newer version of php is installed).

What else do I need to do?

  • 1
    The PHP 5.1.6 part makes me think that this is you trying to get PHP 5.3.x on a RHEL5 or CentOS 5 machine. If that's the case, you should realize there's already a binary package for that (which includes its own apache configuration) called php53. You'll have to uninstall the regular php package, since there are obviously going to be conflicting files between the two. – Bratchley Jun 19 '13 at 17:12
  • The default version is lower than 5.3.x, and I currently can't get this off RH due to subscription problems. – octopusgrabbus Jun 19 '13 at 17:45
  • Have you tried installing the php53 that CentOS provides? Even though it's RHEL the RPM should still work for what you're doing. – Bratchley Jun 19 '13 at 18:53

This will vary slightly based on the distribution you're using. In all cases, you need to change what's being loaded by Apache in the httpd.conf file.

Debian based systems (Ubuntu, etc) use a structure of include files which are included into httpd.conf, rather than editing it directly. All of the module include directives are stored in /etc/apache2/mods-available as .conf and .load and then if they're enabled, a symlink is created in /etc/apache2/mods-enabled

Following the Debian convention, the best way to changeover to the new PHP would be to disable the current PHP module using a2dismod.

a2dismod php5

Then copy the php5.conf and php5.load files in /etc/apache2/mods-available to a new name such as php53.load and change the path to your new .so file so that you can later switch back to 5.1.6 easily if necessary.

Finally just enable the new module with a2enmod.

a2enmod php53

As it turns out, I needed to rebuild apache from source, including apr, apr-util, and pcre. Then I rebuilt php with make distclean; ./configure --with-apxs2 --with-curl; and then make && make install.

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.