Install PHP 5.6 on Linux/Debian systems

Here are the steps to install PHP 5.6 on Debian systems

  1. Update:

    apt-get update
    apt-get install python-software-properties
    apt-get install software-properties-common
    apt-get update
  2. Install Zip/Unzip:

    apt-get install zip unzip
  3. Add PHP5 package sources to your system:

    add-apt-repository ppa:ondrej/php

    If you get error here about Python Unicode, then it’s a problem of locale language set in your local machine. To fix you need to update locale and set, follow these steps:

    locale-gen en_US.UTF-8
    export LANG=en_US.UTF-8
    export LC_ALL=en_US.UTF-8
  4. Update:

    apt-get update
  5. Install PHP5.6:

    apt-get install php5.6
  6. Install other Laravel dependencies:

    apt-get install php5.6-mcrypt php5.6-curl php5.6-mysql
    apt-get install libapache2-mod-php5.6 php5.6-mbstring php5.6-xml
  7. Check the newly installed PHP5 version:

    php -v
    php5 -v