Report this

What is the reason for this report?

How to update PHP on my LEMP stack droplet (ubuntu)?

Posted on February 18, 2018

I have a LEMP stack droplet, but I guess DO uses custom versioning or something since php -v returns a message that I don’t have php. I do have it though, its just version 5.5.9 and I’d need at least 5.6 or later.

How could I update php to the latest stable version, or at least to 5.6, without breaking existing stuff on my droplet?

Many thanks

apt-get upgrade does for the reason above



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

How and when have you deployed LEMP stack Droplet? As far as I know, the latest ones are based on Ubuntu 16.04, therefore should have PHP v7.0+.

If you’re running older version, such as Ubuntu 14.04, you can follow the How To Upgrade to PHP 7 on Ubuntu 14.04.

Make sure your applications is ready for migration. For example, mysql_* functions have been removed in PHP 7, so if your applications are dependent on them, they’ll not work.

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.