Ubuntu 12.04에서 php 버전 5.3 에서 5.5 업그레이드 하기

돌아다니면서 구한 자료로 공부하는 공간입니다..

틀린부분이 있다면 말씀해주시면 수정하도록 하겠습니다.

※ 남을 비방하거나 욕 / 정치적인 글은 삭제 대상이 됩니다. ※

Ubuntu 12.04에서 php 버전 5.3 에서 5.5 업그레이드 하기

Recently I made the decision to stop living in the past and start living in the present by using the latest stable release of PHP, version 5.5.8. Unfortunately on Ubuntu 12.04 LTS (I always run LTS releases on my servers) the latest version of PHP available is from the 5.3 branch which was initially released in June of 2009. Even though 5.3 is still receiving security fixes there are a ton of new features and performance optimizations in 5.4 and 5.5 (and soon enough 5.6). Fortunately it's really easy to upgrade to 5.5 on Ubuntu 12.04 LTS by way of a PPA.


Before we get started, you will want to make sure you have python-software-properties install so you have the command to add a PPA. To do so run:


sudo apt-get update && sudo apt-get install python-software-properties

Great, next up we'll add the PPA and update:


sudo add-apt-repository ppa:ondrej/php5

If you happen to want to use PHP 5.4 instead of 5.5 you would run this instead:


sudo add-apt-repository ppa:ondrej/php5-oldstable

After the PPA has been added, all you need to do is update and upgrade. This will upgrade your currently installed version of PHP to the latest as well as any modules. Please note that even though I highly recommend php5-suhosin it is not available for PHP 5.4+ and will be uninstalled instead of upgraded. Unfortunately the project seems to have fallen to the wayside and some (not necessarily all) of it's functionality has been added to the PHP core.


sudo apt-get update && sudo apt-get dist-upgrade

Once this is done, you will want to restart your web server software and/or fast process manager. I personally use nginx with php5-fpm but this should work for other stacks as well.


If only it were that easy, I do have a couple of gotchas for you. First, if you compiled phpredis for PHP 5.3 you will either need to recompile it against PHP 5.5 or simply install the php5-redis package which is provided by the PPA. The plus side if you no longer have to compile phpredis moving forward if you don't want to.


The second gotcha has to do with php5-fpm. If you are using to PHP listening on port 9000 and happened to overwrite your www.conffile you will be listening on the UNIX socket instead of port 9000. Listening on the socket is the default for this PPA and may result in some gateway connection errors until you either go back to listening on port 9000 or update your web server configs to point to the sock file instead.


I've been running 5.5 for a week now with minimal impact aside from some deprecation warnings in my logs. If you're still on an older version of PHP I highly recommend upgrading to the latest for the new year!

, ,

0 Comments
제목