Programming + Design

Setting up old versions of PHP/MySQL PDF Print E-mail
Written by Brett Brewer   
Saturday, 01 November 2008

I've spent countless hours, weeks actually, trying to set up some older versions of php/mysql on Linux for testing purposes. Sadly, there's still a real need for PHP4/MySQL4 development for legacy applications and NO good ways to manage multiple versions on one machine. In particular, many people running the Xcart 4.0 branch are running on PHP4 and MySQL 4.1. Trying to run these sites on MySQL5 or PHP5 is impossible without serious modifications to the source code. So I decided to set up a test server in or two in VMWare and get the versions I needed installed. I wanted to be able to switch versions of php and mysql at will. This proved to be impossible with every flavor of Fedora that I tried and hours of searching revealed no better solutions for other Linux distros. Rather than detail my incredible waste of time trying to install everything from source, I will tell you my final solution, which is to use XAMPP for Linux to install your preferred combination of php/mysql for testing. It's not a perfect solution, but the XAMPP package will let you run various flavors of PHP/MySQL and lets you switch between php4 and php5 at will when you start your servers. You are stuck with the versions of php4/php5/mysql included in whichever XAMPP distro you choose, but if you browse the XAMPP archives, you can find a version with most combinations of php/mysql that you will need to test on. If you click the "release notes" icons next to each distro at SourceForge you can see what versions of PHP/MySQL are included. In particular, XAMPP version 1.4.16 includes PHP 4.4.0, PHP 5.0.x and MySQL 4.1.14. So it's a great combination for people working on transitional PHP/MySQL apps. After MySQL 4.1.x the SQL interpreter was changed to comply with strict SQL standards and it broke some JOINs in x-cart and many other PHP apps. If you have a client that can't or won't upgrade their apps to be compatible with the newer versions of PHP/MySQL, you almost have no choice but to run your own test server with older versions of PHP/MySQL and XAMPP has made this a super-simple task. The only problem I've found is that the instructions are non-existent. I did find this how-to , but that's about it. They don't tell you that all you need to do is untar the XAMPP distro and drop the"lampp" folder into your Linux "/opt/" directory. That's the big trick, it needs to be in the /opt/ directory. Then cd into the /opt/lampp directory and type "./lampp start". That's it! Everything resides in subfolders in the /opt/lampp/ directory, so you can tweak your configuration. If you have problems not being able to start XAMPP properly due to existing services not being uninstalled, you'll need to stop your existing services first and then preferably uninstall all your existing copies of php, mysql, httpd etc. If you installed your previous copies from source, you can simply go to their source directories and type "make uninistall", otherwise you can use yum or rpm, which is a whole other story. You may also need to search for existing processes from your old mysql or httpd servers and kill them. I had to manually kill my previous mysql process by searching for "", then opening the "" file to find out the actual pid I needed to kill. Once you know the pid simply type "kill xxxx" where xxxx is the pid. Also, you may get an error with phpMyAdmin and other apps complaining they can't connect to "localhost.localdomain". To fix, this, simply add the following line before any other lines to /etc/hosts:     localhost

That was the only major problem I had to fix to get it XAMPP working on my test machine running Fedora Core 4. I just can't believe I wasted over a week messing with source files before I stumbled onto this. I know there's got to be a better way than using XAMPP because I saw someone do a demo at a PHP conference where they ran a test script through 8 different versions of PHP from the commandline. It seems like there should be a nice GUI for Linux that will just let you install a bunch of versions of PHP and MySQL and arbitrarily switch between them. If anyone out there knows of such a thing please use my contact form to let me know. 

Last Updated ( Saturday, 01 November 2008 )
< Prev   Next >


Who's Online

© 2017
Joomla! is Free Software released under the GNU/GPL License.