Skip to content

Deploying PHP applications

New Courses Coming Soon

Join the waiting lists

When you’ve got an application ready, it’s time to deploy it and make it accessible from anyone on the Web!

PHP is the programming language with the best deployment story across the Web.

Trust me, every single other programming language and ecosystem wish they were as easy as PHP.

The great thing about PHP, the thing it got right and allowed it to have the incredible success it had, is the instant deploy.

You put a PHP file on a folder served by a Web server, voilà it just works.

No need to restart the server, run an executable, nothing.

This is still something that a lot of people do. You get a shared hosting for 3$/m, upload your files via FTP, done.

These days however I think Git deploy is something that should be baked into every project, and shared hosting should be a thing of the past.

One solution is always having your own private VPS (Virtual Private Server), which you can get from services like DigitalOcean or Linode.

But managing your own VPS is no joke, it requires serious knowledge and time investment, and constant maintenance.

You can also use the so-called PaaS (Platform as a Service), which are platforms that focus on taking care of all the boring stuff (managing servers) and you just upload your app and it runs.

Solutions like DigitalOcean App Platform (which is different from a DigitalOcean VPS), Heroku and many others are great for your first tests.

These services allow you to connect your GitHub account and deploy any time you push a new change to your Git repository.

See how to setup Git and GitHub from zero

This is a much better workflow compared to FTP uploads.

Let’s do a bare bones example.

I created a simple PHP application with just an index.php file:

echo 'Hello!';

I add the parent folder to my GitHub Desktop app, I initialize a Git repo and I push it to GitHub:

Now go on

If you don’t have an account yet, use my referral code to sign up get $100 free credits over the next 60 days and you can work on your PHP app for free.

I connect to my DigitalOcean account and I go to Apps → Create App.

I connect my GitHub Account and select the repo of my app.

Make sure “Autodeploy” is checked, so the app will automatically redeploy on changes:

Click “Next” then Edit Plan

By default the Pro plan is selected.

Use Basic and pick the $5/m plan.

NOTE: you pay $5 per month, but billing is per hour, so you can stop the app any time you want

Then go back and press “Next” until the “Create Resources” button appears to create the app. You don’t need any database otherwise that would be another $7/m on top.

Now wait until the deployment is ready:

The app is now up and running!

→ Get my PHP Handbook

Here is how can I help you: