How to Upgrade PHP 5.3 to 5.5.9 on Ubuntu 12.04 to Support Drupal 8

| Servers | 3 seen

That day finally have come and I've officially started a new project on my first Drupal 8 website. While my first attempts were about two years ago, but due to the lack of time and will to explore new things and configure new servers I proceeded just tonight (after a conversation with a long time customer we agreed to make a re-branded website and I was allowed to "experiment" with a Drupal 8 site)

I took me some time to get it running as I wasn't prepared for the Drupal 8 requirements, and one of them, is to run on at least PHP 5.5.

I have two linodes configured - one for this blog only and second for all the other websites. Both boxes are configured on Ubuntu 12.04, which is shipped with the php 5.3 version, and of course Nginx. They run smooth for Drupal 7, but speaking for Drupal 8 it took me about an hour to get things right. I got too many 502 bad gateway and 500 internal errors, while I found this great article: Upgrading PHP to 5.4 on Ubuntu 12.04 LTS to support Drupal 8.

The idea is to keep Ubuntu 12.04 (for a while), but upgrade php version only

Optional: The add-apt-repository command is not necessarily installed in 12.04, in which case you get "add-apt-repository: command not found". to fix this:

sudo apt-get install python-software-properties

for PHP 5.5.x run:

sudo add-apt-repository ppa:ondrej/php5

​And then update your packages:

sudo apt-get update

sudo apt-get upgrade

Update the packages, but not update the Ubuntu release

sudo apt-get dist-upgrade

​Again, 502 bad gateway problems

After this upgrade I got all my other Drupal 7 sites 502 bad gateway notice, to fix this I had to edit /etc/php5/fpm/pool.d/www.conf and change /var/run/php5-fpm.sock back to (see my default Drupal + Nginx server block config. I had to follow another great tutorial on how to Fix “502 Bad Gateway” error on NGINX server after upgrading PHP

Of course you may never forget to restart the NGINX and PHP5-FPM services! You would be surprised how many people forget this step. It is necessary to do this so that the updated configuration files are loaded.

sudo service php5-fpm restart

sudo service nginx restart

Hopefully this article/draft helped you solve issue similar I got tonight. Check out other server config tutorials or see some cool tips on Drupal development.