Technology, Tutorial, Ubuntu

How to Install Older PHP and Server Software with Digital Ocean

Why? Someone asked me to set up some old proprietary server software stuff that would no longer work in a modern server environment. I figured it might be possible if we match the mysql and php versions and give it a shot. Here is my documented journey in case anyone else needs to / wants to do something similar.

Set up Digital Ocean (DO) account

  • ubuntu 20.04
  • $5/month
  • old intel
  • hosted in Canada
  • basic setup

Set up URL / Domain/ Networking in Digital Ocean

See big step one from my blog for more.

Update and Upgrade

  • Update: sudo apt update
  • Upgrade: sudo apt upgrade
    Note: if / when it asks about modified ssh file, keep local installed one (i guess….)

Install some unzipping software

sudo apt install unzip (need this to unzip your files probably)

Install Apache

Install it: sudo apt install apache2

Key Step: Install your old PHP

Your Ubuntu server will come with the latest php (currently 7.4, I believe). To downgrade to old versions, you’ll need to do it manually.

NOTE: these two commands at the end, however, didn’t work (at least for PHP 5.6) but I recall they worked on more recent versions of PHP…:

sudo update-alternatives --set phpize /usr/bin/phpize7.3

sudo update-alternatives --set php-config /usr/bin/php-config7.3

Move Files to Server

  • cd to where files are on local machine
  • Consider renaming your zip file of the folder to something that you can just extract and keep
  • SFTP into the server: sftp root@123.123.123.123
  • Upload the zip file from local machine to server: put filename.zip

Do Permissions

Adjust the ‘foldername’ part to whatever your files are:

  • sudo chown -R www-data:www-data /var/www/html/foldername
  • sudo chmod -R 755 /var/www/html/foldername/

Install mysql and Create Database

This blog in the mysql section is good

Virtualhost file updates

“Big Step 7” from my blog should work just fine

At this point you should be able to hit whatever index page or install page you are trying to hit. If not, and if you still get white pages, etc, you may have to keep updating your PHP and mysql versions.

Conclusion

Hope this helps. Yeah.

Tagged , , , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *