Install php7

  1. sudo apt-get install python-software-properties 
    sudo add-apt-repository ppa:ondrej/php 
    sudo apt-get update 
    sudo apt-get install -y php7.0 
    sudo apt-get install -y php7.0-common php7.0-cli php7.0-fpm php7.0-curl php7.0-sqlite3 php7.0-json php7.0-tidy php7.0-mysql php7.0-cgi
    
  2. Now its time to adjust a few settings int the config.
  3. Start with making a backup in case you mess something up and want to revert.

    sudo cp /etc/php/7.0/fpm/php.ini /etc/php/7.0/fpm/php-backup.ini
    

    Now its time to adjust a few settings in the config.

    One is REALLY important that you configure for security reasons.

    to do this open up the config with>

    sudo nano /etc/php/7.0/fpm/php.ini
    

    hit: ctrl+w

    put in pathinfo

    and you will be taken to the correct section
    you will see this line commented out:

    ;cgi.fix_pathinfo=1
    

    Uncomment and change that to:

    cgi.fix_pathinfo=0
    

    then next thing we have to do is increasing the max file size to be upload.

    Search again with ctrl+w: upload_max_filesize

    change it to 64M instead of 2M which is recommended:

    upload_max_filesize = 64M
    

    one last thing that can be nice to edit while we are here is the timezone settings.

    date.timezone
    

    you can find the supported timezones here:

    http://php.net/manual/en/timezones.php

    In my case it’s London both for my target audience and the server!

    so I remove the ; to make the setting active and then I add Europe/London:

    date.timezone = Europe/London
    

    Afterwards I hit ctrl X and push Y to save the settings.

    and then hit Enter when the filename comes up.
    Restart php by writing:

    sudo service php7.0-fpm restart
    

Add your comment