Install PHP 7.2 on Linux/Debian systems

Here are the steps to install PHP 7.2 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 php7.2
  6. Install other Laravel dependencies:

    apt-get install php7.2-curl php7.2-mysql
    apt-get install libapache2-mod-php7.2 php7.2-mbstring php7.2-xml php7.2-opcache php7.2-gd php7.2-zip
  7. Check the newly installed PHP version:

    php -v