Install PHP 7 and Snapshot restore

Linode Staff

Hi,

I need help installing PHP 7 on my Linode. I tried it a few weeks ago but I just messed everything up so I restored one of the backups. Can you help me install PHP 7? Also, I've restarted my Linode with the backup disk, can I safely delete the previous Ubuntu and Swap disks? And also, can I take a new snapshot without overwriting the one I'm using to boot right now?

1 Reply

Hello,

You can install PHP 7 on Ubuntu by running the below command:

sudo apt install php7.0 libapache2-mod-php7.0 php7.0-mysql

For additional cURL, JSON, and CGI support you can run:

sudo apt install php7.0-curl php7.0-json php7.0-cgi

Once PHP7.0 is installed, edit the configuration file located in /etc/php/7.0/apache2/php.ini to enable more descriptive errors, logging, and better performance. The following modifications provide a good starting point:

/etc/php/7.0/apache2/php.ini

  1. maxinputtime = 30
  2. errorreporting = ECOMPILEERROR | ERECOVERABLEERROR | EERROR | ECOREERROR
  3. error_log = /var/log/php/error.log

Then Create the log directory for PHP and give ownership to the Apache system user:

sudo mkdir /var/log/php

sudo chown www-data /var/log/php

Restart Apache:

sudo systemctl restart apache2

You can find more information about installing PHP and other LAMP application in this awesome guide:

How to Install a LAMP Stack on Ubuntu 16.04

In regards to your snapshot questions, if you have all the data you need from that disk locally saved then you can safely delete the previous Ubuntu and Swap disks. If you remove the disk the Snapshot for that disk will disappear, and then be replaced by any new snapshot that is made from a new image.

You can find more information on Restoring from a Backup in this guide:

Restore from a Backup

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct