Drupal 8 update PHP version to 5.4.5 and higher
You may have encountered an issue with an outdated PHP version for Drupal and seen the following error:
Your PHP installation is too old. Drupal requires at least PHP 5.4.5. See the system requirements page for more information.
In that case, you’ll need to contact your hosting provider to upgrade the PHP version. If you're running a virtual or dedicated server, you'll need to handle the update yourself. Initially, Drupal 8 required PHP 5.4.2+, but starting with version 8.0.0 beta 2, the requirement increased to 5.4.5+, which is problematic if your server runs, for example, 5.4.4.
I use Debian/Ubuntu as the server OS for Drupal, so the following commands are for those systems.
You could simply upgrade your Ubuntu distribution to 14.04 to get PHP 5.5.9 by default. But if you’d rather not upgrade the whole OS, here’s how to update just PHP.
To upgrade to PHP 5.4.x:
sudo add-apt-repository ppa:ondrej/php5-oldstable
To upgrade to PHP 5.5.x:
sudo add-apt-repository ppa:ondrej/php5
Then update packages:
sudo apt-get update
sudo apt-get upgrade
More details about the PHP repository can be found at https://launchpad.net/~ondrej/+archive/php5.
If you get an error like:
sudo: add-apt-repository: command not found
Install the required software properties with:
sudo apt-get install python-software-properties -y && sudo dpkg-reconfigure python-software-properties
If you see this message during upgrade:
The following packages have been kept back:
libapache2-mod-php5 linux-generic linux-headers-generic linux-image-generic php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php5-pgsql php5-xdebug
Resolve it by manually installing those packages:
sudo apt-get install php-pear php5-cli php5-common php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php5-pgsql php5-xdebug
Don’t forget to restart Apache or reboot the server afterward.
In my case, PHP version 5.4.4-14 was installed, and Drupal 8.0.0 beta2 successfully ran on it: