
Last month, a new version of PHP was released: PHP 5.3. PHP 5.3 contains a number of new features and bug fixes. Along with those new features, a few older functions have now been deprecated (to prepare for PHP 6.0, which will remove them). You can find out all about all the changes in the changelog.
However, we won’t be talking about the changes in PHP 5.3, rather we’ll be talking about how to upgrade our servers to it. While you certainly don’t have to upgrade your version of PHP, it is recommended that you do so. PHP 5.3 includes a number of bug fixes and potential security fixes. PHP 5.3 shouldn’t break any of your current code, although you may get some deprecated warnings (you can turn these off, although you should fix them).
Upgrading PHP is just like installing PHP. For completeness sake, we’ll go over the steps necessary. First of all, login via SSH. Next, download PHP (choose the .tar.gz file) to your server using wget. Now extract the archive and change your current directory to the extracted one:
tar -zxf php-5.3.0.tar.gz
cd php-5.3.0
Next, run the following commands to configure, compile and install PHP:
/configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-curl --with-mcrypt --enable-mbstring --with-gd --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --enable-zip --with-bz2 --with-zlib
make
make install
Now, you can choose to overwrite your current PHP configuration file with the new one (then make any changes you made) or just leave your current one. If you want to use the new one, run the following command:
cp php.ini-production /usr/local/lib/php.ini
After you’ve installed PHP, you now need to restart Apache for the change to take effect:
apachectl -k restart
There you have it, your server is now running PHP 5.3. Let me know if you have any questions in the comments. Also, if you have any recommendations for future posts in the series, post them in the comments as well.




