Downgrading PHP

Hi,

Many people seem to have a lot of questions about downgrading php, and evidently many do not know about the roll-back option in easyapache.

***Important: This feature is marked BETA by cpanel, and may have unexpected results.***

It is also important to note that this will roll back both the apache install and *DSO php* installed. It will not roll back the command line php version, or the suphp/fcgi php options as those use the command line binaries. If the previous install used DSO and a recent build switched it to FCGI/SUPHP however, this will work. To roll back for suphp/fcgi you will have to do a normal recompile.

The /scripts/easyapache tool has a feature that allows you to roll back to a previous build.

You can invoke this option like so:

/scripts/easyapache --restore-archive --force

You will see the most recent build, as well as various builds by archive date. This is the date they were *replaced* rather than built.

Example:
| Previous backup
| <> Build archived '2010-03-02 22:12:09Z'
| <> Build archived '2010-03-03 01:21:59Z'
| <> Build archived '2010-11-04 22:38:06Z'

These builds are archived in the following locations:

/usr/local/apache.backup

^^^this is the “Previous Backup^^^

/usr/local/apache.backup_archive

^^^this directory contains the rest, in directories named according to the time archived.^^^

If you are hunting through these for a specific version of DSO php, you can run this:

find /usr/local/apache.backup_archive/ /usr/local/apache.backup/ -name 'libphp?.so' | xargs strings -f | grep 'X-Powered-By'

That output should look like this if any of the previous builds have DSO php:

/usr/local/apache.backup_archive/20120802.1343866469/modules/libphp5.so: X-Powered-By: PHP/5.2.17
/usr/local/apache.backup_archive/20100303.1267579319/modules/libphp5.so: X-Powered-By: PHP/5.2.12
/usr/local/apache.backup/modules/libphp5.so: X-Powered-By: PHP/5.2.17

That should let you determine which build to restore.

Note: “php -v” will show the cli verison. If you want to know the version of the current DSO to confirm that the restore worked, run this:
strings -f /usr/local/apache/*/libphp5.so | grep 'X-Powered-By'

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.