Downgrade PHP Version from 5.5 to 5.2 on Ubuntu 14.04

Posted October 22, 2014 18k views

I´m currently migrating some pretty old clients sites (that I didn’t code) to DO and I´m facing many php error related (I guess) with the new PHP version installed by default.
I didn’t found any article related to the topic and thought that maybe I could get some advise from the community.
I found this article:

Should I create a new droplet with Ubuntu 12 instead?
Is there an easy to follow DO article that I may read to get specific PHP versions/site?


1 comment

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.

Submit an Answer
3 answers

PHP 5.2 has been depreciated. If your code relies on abilities in 5.2 that aren’t in 5.4, you might want to ask yourself why the removed them from 5.4. They remove features (rather than provide depreciation warnings) when it’s a vulnerability/insecure.

If your code needs 5.2, you might want to downgrade your OS, but again, that’s not secure.

The best solution is to fix the code so it works on current PHP versions.

  • Thanks both for your comments!
    After a couple of hours trying to figure out how to use phpbrew I just start to figure out the security issue, not being able to download 5.2 version even from php site was the clue.
    “My” code need for sure 5.2 and I manage to fix many issues I will fix them all and keep the secure way, the hard way ;)
    Thanks again.

One more note on this – just in case your code can run on PHP 5.3, an easier fix is to install Ubuntu 12.04. It’s a LTS (Long Term Support) release and comes packaged with PHP 5.3.

I have an isolated Ubuntu 12.04 droplet with PHP 5.3 running for a similar purpose…a stubborn client who refuses to make the investment to update their site.

  • Thanks, already try on 5.3 and is not not solving the main problem (show data from database in a custom made backend)
    Good to know about the LTS release.
    Top community, thanks!

  • Hi,

    How can I do it? (PHP v 5.3)
    If I create a new droplet with Ubuntu 12.04 and install each piece of LAMP stack, after all I will have PHP 5.5.x. How can I downgrade in this case?