1. Prepare a release
Test the changes locally or in staging. Review the Git diff, run automated tests, and check PHP syntax:
php -l public/index.php
For a larger project, lint all PHP files and run the project's test suite.
2. Back up the current release
Back up both application files and the database. Confirm that the backup is usable and that you know how to restore it.
3. Install dependencies
If the project uses Composer and includes a lock file:
composer install --no-dev --optimize-autoloader
Run this with the intended PHP executable and compatible extensions.
4. Apply database changes
Use versioned migrations or carefully reviewed SQL scripts. Take a database backup before schema changes. Avoid re-importing seed data or replacing production tables during a routine release.
5. Configure the environment
Set production credentials and service URLs outside the public web root where possible. Ensure debug output is disabled and logs are stored privately.
6. Check permissions
The web process should have only the write access it needs, such as to a designated cache or upload directory. Application source files should not be broadly writable.
7. Run smoke tests
Check the homepage, login, forms, database-backed pages, file uploads, scheduled jobs, and error logs. Keep the previous release available for rollback until the new version is verified.