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

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

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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.