Deploying a PHP 7 App to a PHP 5.6 Server

Patrick Guevara
Looped In

--

Last week, we designed, built, and launched metricloop.com. We released the new design on Tuesday and set a deadline for ourselves to post our first blog article that Friday at 8 pm. We worked quickly to create a reliable platform to handle the company blog, taking design cues from Medium and putting our own spin on it. We finished the platform at about 4:30 pm on Friday and moved to deploy to production in preparation for the 8 pm deadline.

We created the database, set up all the credentials, and deployed. We immediately received an error from Laravel Forge that something went wrong during deployment.

See, we use Laravel Homestead running PHP 7 for our development environment and most of our production servers are also running PHP 7. The one server that isn’t? The one hosting our website. Yes, we accidentally deployed an application requiring PHP 7 to a server running PHP 5.6. It immediately hogtied the server and we couldn’t do anything from within Forge to save it.

Yes, we accidentally deployed an application requiring PHP 7 to a server running PHP 5.6.

We could either spend time trying to roll everything back to keep a PHP 5.6 server in production, or take the hit and finally move everything over to PHP 7. Thanks to Forge, we were able to quickly provision a new server (with PHP 7), install the repository from Github, run the migrations, and get the site back up. Then we just had to update the DNS records with GoDaddy and wait. Now the scare of deploying with conflicting versions is no longer an issue!

All told, we were down for an hour because of a stupid mistake. So remember, always verify your development and production environments!

Originally published at metricloop.com on March 1, 2016.

--

--

Patrick Guevara
Looped In

Software Dev @GoMedigap. Previously @MetricLoop.