How to upgrade PHP 5.3.xx to PHP 5.4.0

1 March 2012, I get a good news from PHP development team and they informed that PHP 5.4 has been released and available for download. I’m so exited and can’t wait to upgrade from PHP 5.3.10. Actually I don’t have any issue with PHP 5.3.10 but I just wondering to use PHP 5.4 on my web server. “Some of the key new features include: traits, a shortened array syntax, a built-in webserver for testing purposes and more. PHP 5.4.0 significantly improves performance, memory footprint and fixes over 100 bugs” quote from release announcement.

The key features of PHP 5.4 include:

  • New language syntax including Traits, shortened array syntax and more
  • Improved performance and reduced memory consumption
  • Support for multibyte languages now available in all builds of PHP at the flip of a runtime switch
  • Built-in webserver in CLI mode to simplify development workflows and testing
  • Cleaner code base thanks to the removal of multiple deprecated language features
  • Many more improvements and fixes

Some features has been changed in PHP 5.4:

  • Register globals, magic quotes and safe mode were removed
  • The break/continue $var syntax were removed
  • The ini option allow call time pass reference were removed
  • PHP default charset is no UTF-8 within the distributed php.ini file, but still defauls to””

My PHP service running on CentOS 6.2 x86-64 and PHP compiled and installed from source gzip (tar.gz) PHP-FPM enabled, so how to upgrade PHP? Please follow step below:

1. Download PHP source package from

And then choose your mirror locations


Extract, compile and then install the source file:

tar -zxvf php-5.4.0.tar.gz

cd php-5.4.0

./configureĀ  –prefix=/usr/local/php –enable-fpm –enable-cli –with-mcrypt –with-zlib –enable-mbstring –with-openssl –with-mysql –with-mysql-sock –with-gd –with-jpeg-dir=/usr/lib64 –enable-gd-native-ttf –without-sqlite –disable-pdo –with-libdir=lib64 –with-xpm-dir=/usr/lib64 –enable-gd-jis-conv –with-freetype-dir=/usr/include/freetype2 –with-fpm-user=nginx –with-fpm-group=nginx –enable-shared –enable-cgi –enable-sockets –with-mysqli –with-config-file-path=/usr/local/php/lib –enable-exif


make test (sometimes I do)

sudo make install

sudo /etc/init.d/php-fpm restart

That’s all, hope this help

Leave a Reply

Your email address will not be published. Required fields are marked *