404 – Component not found

Leave a Comment

Configuring PHP Extension on Windows – A simple way

Leave a Comment

Downgrading From PHP5/MySQL5 on CentOS 4.X

Lately, we’ve had clients who have upgraded from PHP4/MySQL4 to PHP5/MySQL5, only to find that they have problems with custom PHP scripts and/or Drupal modules not working any more. When that happens, there’s two choices – fix the broken code/modules, or downgrade back to PHP4. As we’re primarily running CentOS 4.X on our systems, we’ve come up with instructions on how to perform a downgrade.

Note, these instructions disable the centosplus repository as part of the downgrade. This works for us, as we’re only using centosplus for PHP5 and MySQL5. If you’re using the centosplus repository for something else, you’ll just need to exclude=php* mysql* instead of disabling the repo outright.

Downgrading From PHP5/MySQL5 on CentOS 4.X

/etc/init.d/httpd stop
rpm -qa | grep “php”

This will give you a list of all PHP packages on the system. Copy down this list, as you’ll need to know the package names for removal/installation.

rpm -e (packages)

Example: rpm -e php php-pear php-mbstring…

/etc/init.d/mysqld stop

cd /var/lib/mysql

mysqldump -uroot -p —compatible=mysql40 —all-databases —add-drop-database > /databases.sql

This is our dump. You might want to use other options, but this is the requisite standard dumping procedure. —add-drop-databases is important, because we’ll be rewriting the ‘mysql’ database to restore access permissions and such.

/etc/init.d/mysqld stop

tar -cvf /mysql5.tar.gz .

We’re making a complete backup of /var/lib/mysql – this is a safety procedure. We do have the database dump we just made, but in the event that anything is funky with that, we’ll be able to restore the database in its entirety with this.

rpm -e mysql mysql-server —nodeps

Edit /etc/yum.repos.d/CentOS-Base.repo

Remove any exclude=php, exclude=mysql from the [base] and [update] sections. In the [centosplus] section, set enabled=0

yum install mysql mysql-server

yum install (PHP PACKAGES)

Note, if you removed php-eaccelerator in step 2, do not list it here. CentOS 4.X distributes it only with PHP5 in the centosplus repository. If you need it for PHP4, check the end of these instructions for how to get it in RPM form.

cd /var/lib/mysql

rm -rf *

Important: Be very, very, very sure you are in /var/lib/mysql when you execute this rm -rf *

cp /etc/my.cnf.rpmsave /etc/my.cnf

/etc/init.d/mysqld start

mysql < /databases.sql

/etc/init.d/mysqld restart

…For good measure.

Edit /etc/php.ini and change any settings you need to. Note, you can’t copy over /etc/php.ini.rpmsave, because PHP5 has some directory changes from PHP4. It’s almost certainly easier to just make any adjustments. Suggested adjustments:

memorylimit = 32M uploadmaxfilesize = 24M postmax_size = 24M

/etc/init.d/httpd start

…And you should be good to go. Now, do you need eaccelerator? rpmforge is where it’s at:

rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm

Edit /etc/yum.repos.d/rpmforge.repo

Add ‘includepkgs=php-eaccelerator’ to the repository’s data

yum install php-eaccelerator

/etc/init.d/httpd restart

…And now you’re good to go with eaccelerator as well!

Leave a Comment

Quick ‘n’ Easy LAMP Server For CentOS/RHEL

Leave a Comment

Mac OS X 10.5: Administrator user changes to standard

Comments (2)

Troubleshooting permissions issues in Mac OS X

Leave a Comment

Ioncube and Mac 10.5.6

Comments (1)

Older Posts »
Follow

Get every new post delivered to your Inbox.