Think Build Implement Repeat
London, UK +44 7367 067226
WhatsApp FOLLOW f in X
  1. Home
  2. Blog
  3. Getting Code to Production Without Drama
PHP Development

Getting Code to Production Without Drama

Deploying PHP applications safely: why FTP uploads are not a process, staging that matches production, database migrations, secrets and a tested rollback.

Updated 2 min readBy SpiderHunts Technologies

Free estimateNo obligation

Get a free estimate

Tell us what you need. A senior engineer reads every enquiry.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →

Quick answer — TL;DR

Version control, a staging environment that matches production, a repeatable deployment process and a tested rollback. Uploading files over FTP is not a deployment process.

FTP is not deployment

Copying files to a live server means partial states where some files are new and some are old, no record of what changed, and no way back except copying older files over the top.

Every production incident we have been called into that started with “we just uploaded a fix” would have been prevented by a proper deployment process.

What a process needs

  1. Code in version control, deployed from a specific commit
  2. Dependencies installed as part of deployment, not uploaded
  3. Database migrations run in a controlled order
  4. Atomic switch so the site never serves a half-deployed state
  5. A tested rollback, not a theoretical one

Environments that match

  • Same PHP version as production
  • Same database engine and version
  • Same extensions enabled
  • Configuration through environment variables, not edited files
  • Test data that resembles production in shape, not in content

“It worked on staging” is only useful if staging resembles production. Different PHP versions between the two makes the staging environment nearly worthless.

Database migrations need care

Schema changes are the part of deployment that cannot easily be rolled back. Design them to be backwards compatible where possible: add columns before using them, remove them in a later deployment.

That discipline means a rollback of code does not require a rollback of the database, which is what makes rollback practical.

Secrets belong in the environment

NeverInstead
Credentials in the repositoryEnvironment variables
Production keys on developer machinesSeparate credentials per environment
Config edited on the serverConfig from the environment
Shared loginsIndividual accounts with audit

FAQ

Frequently asked questions

The questions readers ask us after this guide.

Still have a question?

Ask us directly — a senior engineer will get back to you.

Ask about your project

Do we need continuous deployment?

Not necessarily. A repeatable, documented process run manually is a large improvement over FTP and is enough for many businesses.

How do we roll back a migration?

Design them to be reversible, or make them backwards compatible so code can roll back independently. The second is usually more practical.

What about zero-downtime deployment?

Achievable with an atomic switch between releases. Worth it where any downtime has a cost.

Should developers have production access?

As few as possible, individually accounted for, with an audit trail. Shared credentials are the common failure.

Keep reading

More on PHP Development

PHP Development

Why PHP Is Still a Sensible Choice

Is PHP still a good choice for business applications? Where modern, typed PHP fits, where another language is better, and the hosting and hiring arguments.

PHP Development

Improving Old Code Without a Rewrite

Modernising a legacy PHP application without a rewrite: move to a supported PHP version, add tests around what matters, then strangle rather than replace.

Start here

Deploying by uploading files?

A proper process is a day of setup and it prevents the incident you have not had yet.

  1. You tell us what you needTwo minutes on the form, or a message on WhatsApp.
  2. A senior engineer reviews itAnd comes back with questions, a realistic range and an honest view on fit.
  3. Free 30-minute scoping callWe talk through scope, options and a realistic estimate — with no obligation.
Free estimateNo obligation

Talk to someone who builds this

Send a short brief and we will come back with an honest view and a realistic range.

Takes under a minute. We never share your details.

  • Free consultation
  • No commitment
  • NDA on request

Prefer to talk? Book a free 30-minute call →