First month on a legacy PHP system
Taking over a live PHP application is not a rewrite project. It is access, a map, a safe way to deploy and a runbook - before you touch the money paths. Here is the 30-day plan we follow.
TL;DR
- Week 1: collect every access (code, servers, DNS, payments, email, monitoring) and write down what is unclear.
- Week 2: make the app run locally in Docker and make deploys boring and reversible.
- Week 3: map money paths, cron jobs, queues and integrations - and what happens when each fails.
- Week 4: write the runbook, fix the riskiest problems, and only then discuss upgrades or a rewrite.
- A legacy PHP handover succeeds when knowledge stops living in one person's head.
A legacy PHP handover usually starts with a message like "our developer is leaving, can you take over?" The system is live, customers pay through it, and the documentation is a README from five years ago. We take over PHP projects regularly - custom cores, older Yii and Yii2 applications, early Laravel versions - and the first month always follows the same plan. The goal is not to judge the code. The goal is to make the system operable by someone other than its author.
Week 1. Access before opinions
Do not start with a tour of the codebase. Start with an inventory of everything you need to run, fix and deploy the system. Our access checklist:
- Source code: all repositories, including forgotten ones for cron scripts, mobile backends or admin panels.
- Servers: SSH access, hosting and cloud consoles, control panels, backup locations.
- Domains and DNS: registrar, DNS provider or Cloudflare, SSL certificates and who renews them.
- Databases: credentials, the latest backup and proof that it can be restored.
- Third parties: payment providers, email sending, SMS, maps, analytics, any API with a key.
- Monitoring and logs: where errors go and who receives alerts today.
- Billing for all of the above - many outages are simply an unpaid invoice.
Use the outgoing developer for what git cannot show: the cron job that must not run twice, the server that is "special", the client who has a custom price hard-coded. Write every answer down the same day. Ask for credentials to be transferred to company-owned accounts, not shared personal logins.
Week 2. Make it run and make deploys boring
If the application runs only on one hand-configured server, that is the first risk to name. A Docker Compose file that brings up PHP, the web server, the database and Redis on a laptop is worth more than any architecture diagram:
services:
php:
image: php:7.4-fpm # match production first, upgrade later
volumes: [".:/var/www/app"]
nginx:
image: nginx:stable
ports: ["8080:80"]
volumes: [".:/var/www/app", "./docker/nginx.conf:/etc/nginx/conf.d/default.conf"]
db:
image: mysql:5.7
environment: { MYSQL_DATABASE: app, MYSQL_ROOT_PASSWORD: secret }
redis:
image: redis:6
Match the production versions first, even if they are old. Upgrading PHP and getting the app to run locally at the same time doubles the number of unknowns.
Then make deploys safe. On a legacy system we often cannot add a full CI pipeline in week two, but we can add guard rails. On our own servers, for example, every changed PHP file is syntax-checked inside the production container before it is installed, and PHP-FPM is reloaded gracefully instead of restarted:
# lint with the same PHP version that serves traffic
docker exec -i app_php php -l < new/Controller.php
# install only after lint passes, then reload workers without dropping requests
cp new/Controller.php app/Controller.php
docker exec app_php kill -USR2 1
Combined with git (commit exactly the files you changed, by path) this turns "deploy and pray" into a reversible step.
Week 3. Map the money and the failure modes
Now read the code - but with a purpose. Build a risk map of the paths that matter most:
- Money: checkout, payment callbacks, invoices, refunds, payouts, currency handling.
- Scheduled work: every cron entry, what it does, how long it takes, what happens if it runs twice or not at all.
- Queues and workers: what supervises them and what happens to failed jobs.
- Integrations: every external API, its credentials and its failure behaviour.
- Data: database size, slow queries, tables that grow without cleanup, backup schedule.
- Versions: PHP, framework, database, OS - with end-of-life dates.
For each item note the likelihood of failure and the impact. A table with ten rows is enough. It tells you where the first fixes should go, and it is the document business owners actually read.
Typical findings in legacy PHP
- PHP versions past end of life, with no security updates.
- Credentials committed to the repository.
- Payment callbacks without signature checks or idempotency.
- Error display turned on in production, or errors silenced with
@everywhere. - Backups that exist but have never been restored.
- One giant cron script that does everything.
Week 4. Write the runbook, then fix the top risks
A runbook is a short document for the person on call. Ours usually has these sections:
- How to deploy and how to roll back.
- Where the logs are and what normal looks like.
- The five most likely incidents and the first steps for each.
- How to restore the database from backup, tested at least once.
- Contacts and accounts for every third party.
Then fix the top of the risk map: rotate leaked credentials, add monitoring and alerts, secure payment callbacks, set up tested backups. These fixes are small and visible - and they build the trust you need for bigger decisions.
Rewrite last - if at all
After a month you know the system well enough to talk about its future honestly. Often the right move is incremental: upgrade PHP step by step, add tests around the money paths, extract the most fragile module into a service. Sometimes a migration to a modern framework is justified - for example, the PKSOVA platform moved to Laravel, PostgreSQL and Redis on Docker once the business case was clear. A rewrite should happen because risk and budget say so, not because a newer framework looks better on a CV.
Handover checklist
- All accesses moved to company-owned accounts.
- App runs locally with one command.
- Deploys are linted, logged and reversible.
- Risk map with owners and priorities.
- Runbook tested by someone other than its author.
- Backups restored at least once.
- Alerts reach a channel the team reads.
How we can help
We take over live PHP systems - Laravel, Yii2, custom frameworks - and make them operable: Docker, safe deploys, monitoring and documentation. If you need an outside view first, our architecture review delivers a written report with prioritised findings, and the server analysis or deployment service covers Docker, nginx, PHP, databases, SSL and backups. For integration-heavy systems see our integrations service.
Read also: Custom software development cost: what drives the price and how to estimate it · Legacy system modernization: strategies, costs and a safe migration plan · How to hire a PHP developer: rates, skills, interview questions and red flags
Frequently asked questions
How long does a legacy PHP handover take?
For a typical small or mid-sized application, about a month to reach a stable, documented state: access, local setup, risk map and runbook. Larger systems take longer, but the order of steps stays the same.
Should we rewrite our legacy PHP application?
Rarely as a first step. Make it operable, add monitoring and tests around critical paths, then decide based on risk and budget. Incremental upgrades often deliver most of the value at a fraction of the cost.
What should we get from a developer who is leaving?
All credentials moved to company accounts, a list of servers, cron jobs and integrations, known quirks and a walkthrough of deploy and recovery. Record the sessions if possible.
Can an old PHP version run in Docker?
Yes. Running the exact production version in Docker is often the safest first step: it gives you a reproducible environment before you start upgrading.
Free discovery call
Bring a messy stack or stalled integration - Integrono will map the smartest first move.
You get a senior take on budget traps, dependencies and whether to buy, glue or build - before paid work starts. The CEO stays in the loop.