I have tried to postpone the upgrade for [easyazon-link asin=”0470413964″ locale=”us”] PHP 5.3 [/easyazon-link] to PHP 5.4 on our[easyazon-link asin=”1593270690″ locale=”us”] Debian [/easyazon-link] 6 “Squeeze” for good reason so I do not make more damage to our devteam. All is now tested out and it seems that our server and coders are ready to get the upgrade to PHP 5.4. The steps are simply and easy and all are mentioned here bellow. Sticking with standard (stable) [easyazon-link asin=”1565927052″ locale=”us”] Debian [/easyazon-link] packages is generally a good idea. They provide a comfort of superior security and stability and are tested daily on thousands of production servers worldwide. However mostly time they are outdated and compiling from source can bring another issues – dependencies. The best way to do this is use DotDeb – this is a repository containing packages to turn your Debian boxes into powerful, stable and up-to-date [easyazon-link asin=”076459723X” locale=”us”] LAMP [/easyazon-link] servers. First lets check the version of[easyazon-link asin=”143022925X” locale=”us”] PHP [/easyazon-link] running on my server:
su root@box1#php --version PHP 5.3.22-1~dotdeb.0 with Suhosin-Patch (cli) (built: Mar 2 2013 23:12:49) Copyright (c) 1997-2013 The PHP Group
As you can see I am running PHP5.3 version currently on my server. Now lets do the steps to update 5.3 to 5.4. You will need edit repo file and add few links to it as show bellow
su root@box1# gedit /etc/apt/sources.list #Add these lines into the end of the sources.list # Main dotdeb repository deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all # PHP 5.4 deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all deb http://packages.dotdeb.org squeeze-php54 all deb-src http://packages.dotdeb.org squeeze-php54 all
Now you will need to import and add GPG key
wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | sudo apt-key add -
Now is time to remove the PHP5.3 and get PHP5.4 on your server, however before you do this, it is recommend to save your php.ini file to other location.You can find the location of php.ini by running command find / -name php.ini or use phpinfo() page to locate the file. Now lets remove the old PHP5.3 from your system
su root@box1#apt-get remove --purge php*
Next step is to install your new PHP5.4 on the server, however note the command line since we are using DotDeb there is additional stuff.
su root@box1# apt-get install -t squeeze-php54 php5 php5-mysql php5-imagick php5-json
As you can see in the line you have to use “-t squeeze-php54” to use the repository. Once you updated the packaged, you will need top restart the webserver.
su /etc/init.d/apache2 restart
Now you should have the updated PHP5.4 running on your box.
[easyazon-image align=”none” asin=”111821854X” locale=”us” height=”160″ src=”http://ecx.images-amazon.com/images/I/51FaTk60v9L._SL160_.jpg” width=”127″]