Skip navigation.

Moving to PHP 5.3

Now that PHP 5.2 is at the end of life, we are starting to migrate to PHP 5.3.

Here are some of my experiences with our code:

  • The function session_register() is now deprecated. We have created a wrapper function called _session_register with the same functionality.
    
    //-------------------------------------------
    // php 5.3 compat version of session_register
    function _session_register($v)
    {
    global $$v;
    	
    	if (!isset($_SESSION[$v])) {
    		if (!isset($$v)) $$v = null;
    		$_SESSION[$v] =& $$v;
    	} else  $$v =& $_SESSION[$v];
    }
    
  • Legacy PHP4 code with
         $obj = &new ClassName();
    
    has to be converted to
         $obj = new ClassName();
    
  • Lots of other functions have been deprecated, including split(), ereg(), etc. See PHP 5.3 Manual, Deprecated Features.

    Upgrading Zend Server from PHP 5.2 to PHP 5.3

    Backup your php.ini file. Then run the following commands:
    yum remove php-*
    yum remove mod-php-*
    yum install zend-server-php-5.3
    

    After this, you will need to restore back the settings of your php.ini file.

    Hiding Deprecated Warnings

    Set your error_reporting to
    error_reporting(E_ALL & ~E_DEPRECATED);