With RC2 of the php5.3 release coming out, I wanted to run the new version alongside the stable version on our development server at M State. I wanted to be able to control this behavior via .htaccess files to control particular projects.
What you’ll need:
- Reasonable compiling experience
- Ability to satisfy dependencies
- Understanding and access to your httpd.conf and to be able to reload/restart apache.
Do NOT compile now unless you completely understand how to install to a directory other than the default!
Start off by downloading and extracting the source and cd into the extracted directory.
Getting ready to configure:
Before you configure, make sure you know which modules you want.
These are enabled by the myriad of
--with-gd type switches.
If you don’t know what modules you have, run
phpinfo(); and look for the configure string – OR you can try the command line tool
php-config (or) php5-config if it’s been installed.
You’re not going to want php to be installed into the default path, this will rewrite your stable php5. Instead you want it to go into a custom directory – You can do this by setting the
--prefix option when you run
Using current php.ini (Optional, recommended)
Change the paths to wherever your php.ini file is located. If you’re running older php and don’t have the conf.d folder – don’t use that line. This step may save you any nuances setup in your php.ini files.
Now we’re ready to run the gauntlet of trying to configure and build. Expect to fulfil dependencies. At a minimum our configure will look like this:
./configure throws up that a library isn’t found – this is the least fun part when you have to install the dev libraries for those modules. So if your getting an error about
libxml2 – You’ll likely want to install
libxml2-dev. If you use apt this can be handy:
apt-cache search libxml2 | grep "dev" – once you’ve installed it, try the configure again. It took me about half an hour of configure and installing the dev libs …
You can see my configure string as a comment to this post for example.