Developer guide

Upgrading PHP and Laravel safely: a step-by-step checklist

Developer guide

A PHP upgrade rarely fails because of the language itself. It fails because something nobody listed was still running the old binary, because a package quietly capped the PHP version, or because a deprecation that had been filling the log for a year finally became an error. This guide is the order we follow when moving a live PHP or Laravel system to a newer version. It is written for developers and technical leads, and it assumes a Composer project; most steps also apply to older code without a framework.

The timing matters this month. On php.net, security support for PHP 8.2 ends on 31 Dec 2026, and PHP 8.6.0 was released on 19 Nov 2026. If you are still choosing a target branch, our PHP 8.2 end-of-life page has the support table. This page is about how to get there without surprises.

Step 1: write down what actually runs

Before touching versions, make a short inventory per application:

ItemWhere to look
PHP version serving web requestsphpinfo() on a protected route, or the hosting panel
PHP binary used by cron, queue workers and deploy scriptscrontab, Supervisor or systemd units, CI config
Loaded extensionsphp -m for each binary, compared with what the code uses
php.ini overrides.user.ini, FPM pool files, panel settings
Framework and major packagescomposer.lock
Other code on the same serversites or scripts that share the PHP install

The second row is the one that bites. A site can be switched to a new version while a nightly report or a queue worker keeps calling a hard-coded path to the old binary. Write the paths down now so the cut-over step can change them together.

Step 2: let Composer tell you what blocks the target

Composer already knows most of what you need. Run these on a copy of the project, not on production:

# Which installed packages forbid the target PHP version?
composer why-not php 8.5

# Do the PHP version and extensions on THIS machine satisfy the lock file?
composer check-platform-reqs --lock

# Which direct dependencies have newer releases?
composer outdated --direct

# Known security advisories and abandoned packages in the lock file
composer audit --locked

A few points from the Composer documentation that change how you read the output:

  • why-not (an alias of prohibits) lists the packages whose php requirement excludes the version you name. Each line is a package you must update or replace first.
  • check-platform-reqs checks the real PHP and extensions on the machine where it runs, and ignores any config.platform override. That makes it a good line to add to the deploy script on the new server.
  • If composer.json pins config.platform.php, Composer resolves packages as if that version were installed. Raise it to the new target as part of the upgrade, or the lock file will keep choosing packages for the old version.
  • Since Composer 2.10, versions with known security advisories are blocked during composer update and fail composer audit by default. If an update refuses a version, read the advisory instead of reaching for the bypass flag.

Step 3: read the migration notes for every version you cross

The PHP manual has a migration chapter per release: backward incompatible changes, deprecations, new features and changed functions. If you jump from 8.2 to 8.5, read 8.3, 8.4 and 8.5, not only the last one. A few items from recent chapters that show up in ordinary business code:

  • PHP 8.4 deprecated implicitly nullable parameters (Type $x = null without ?Type), deprecated E_STRICT, and deprecated trigger_error() with E_USER_ERROR. It also changed the default handling of the CSV escape parameter: relying on the default is now deprecated, so pass it explicitly.
  • PHP 8.5 made OPcache always built in (a zend_extension=opcache.so line now produces a warning), removed the disable_classes ini setting, made session_start() stricter about its options array, and added warnings for casts of floats that cannot fit in an integer. Its deprecations include the backtick operator as a shell alias, the non-canonical casts (integer), (boolean), (double) and (binary), null as an array offset, and curl_close().
  • PHP 8.6 changed session defaults (strict mode and HttpOnly on, SameSite Lax) and deprecated several old aliases. Our PHP 8.6 page lists them.

Search the codebase for each item that applies, and keep the list in the upgrade ticket so the review has something concrete to check against.

Step 4: turn deprecations into a to-do list

Deprecation notices are the cheapest warning you will get. On a staging copy running the target version:

  1. Set error_reporting = E_ALL and log_errors = On, with display_errors = Off.
  2. Run the test suite, then click through the main flows by hand: sign-in, the forms that write money or stock, file uploads, exports, emails.
  3. Run every scheduled command and a sample of queued jobs once.
  4. Group the log by message and file, and fix them in batches.

Static analysis and automated refactoring tools help with the mechanical part (adding ? to nullable parameters across a codebase, for example), but review their changes like any other commit. Code that only runs once a month, such as year-end reports, deserves a manual run with realistic data.

Step 5: framework first or PHP first?

For a Laravel system, the framework decides which PHP versions are allowed. According to the Laravel 13 release notes, Laravel 13 supports PHP 8.3 to 8.5, and Laravel 12 is in its security-only window until 24 Feb 2027. Two rules keep this manageable:

  • One major framework version at a time. Go 11 to 12, deploy, then 12 to 13. Each Laravel upgrade guide assumes you are coming from the previous major. The 13.x guide lists the dependency bumps (laravel/framework to ^13.0, PHPUnit to ^12.0, Pest to ^4.0, Tinker to ^3.0) and flags the CSRF middleware rename as high impact.
  • Pick the PHP version both sides support, and move in the order that keeps that overlap. A Laravel 12 app on PHP 8.2 usually moves to PHP 8.3 or 8.4 first (both supported by 12 and 13), then to Laravel 13.

Our pages on Laravel 13 and Laravel support dates have the details.

Step 6: test where it counts

Run CI against both the current and the target PHP version until the switch is done, so nothing new lands that only works on one. Beyond unit tests, check the places where a PHP change shows up as wrong data rather than an error:

  • money and quantity calculations, rounding and number formatting;
  • date handling across time zones and Hijri or Arabic-formatted dates if the system shows them;
  • CSV and Excel imports and exports;
  • sessions, cookies and sign-in across subdomains;
  • PDF and image generation, which depend on extensions.

Step 7: cut over with a way back

On a server you manage, install the new PHP beside the old one and give the application a new FPM pool on the new version. The switch is then a change of one socket path in the web server config, and the rollback is the same line in reverse. In the same change:

  1. Point cron entries, Supervisor programs and deploy scripts at the new binary (the list from step 1).
  2. Restart queue workers so they load the new runtime; long-running workers keep the old one until restarted.
  3. Run composer install --no-dev and composer check-platform-reqs with the new binary.
  4. Clear and rebuild framework caches (php artisan optimize:clear, then php artisan optimize in Laravel).

Keep the old PHP installed until the system has gone through at least one full business cycle that matters to it, such as a month-end close.

Step 8: after the switch

Watch the error log daily for the first week, sorted by new messages. Then make the patch routine part of normal work: apply each security release of your branch as it comes out (the php.net news archive lists them), and run composer audit in CI so a new advisory against a package you use fails the build. The Laravel framework itself has had several advisories in 2026 that were fixed only in newer 12.x and 13.x patch releases, which is a good reason not to let composer update drift for months.

We run this process on the servers we host through our hosting and servers service. For an older system someone else built, where nobody is sure what the code depends on, our custom software team can do the inventory and the upgrade with you.

FAQ

Can I skip PHP versions, for example 8.2 straight to 8.5?

Yes, the runtime does not require stepping through each release. What you cannot skip is reading the migration notes and fixing the deprecations of every version in between, because they all apply at once on the new version.

Should I upgrade PHP and Laravel in the same deployment?

It is safer to separate them. Two changes at once make it hard to tell which one caused a problem, and a rollback undoes both. Choose a PHP version that both your current and target Laravel versions support, and use it as the bridge.

Our host only offers a PHP version selector. Does this checklist still apply?

Most of it. You will not manage FPM pools, but you still need the inventory, the Composer checks, a staging copy on the target version, and a list of the cron jobs set up in the panel, which may name a PHP binary of their own.

Are deprecation warnings safe to ignore in production?

They do not break the site today, but each one is a future error once the feature is removed in a later version. Log them, do not display them, and treat the log as the to-do list for your next upgrade.

How often should we run composer update on a live system?

There is no single rule, but small regular updates within your current major versions are easier to test than a large jump once a year. Run composer audit in CI between updates so security fixes are not left waiting for the next planned round.

Official sources

Visual Innovate

Written by the Visual Innovate team, the people who build, host and follow up systems, websites and apps for our clients in Jordan, Saudi Arabia, Oman and Egypt. We follow the official sources and update this page when something changes.

Are you our next Success Partner?

Tell us the problem as you see it. Within one working day we'll come back with how we understand it and a clear first step.