1. Home
  2. PHP EOL Dates
  3. PHP 8.1

PHP 8.1 End of Life

PHP 8.1 stopped receiving security fixes on December 31, 2025. Here is what that means, what will need attention on the way to 8.3 or 8.4, and a checklist to get there.

End of life
Ended 299 days ago

Security support ended on Dec 31, 2025

9.8%

of PHP websites run 8.1
(W3Techs, Oct 26, 2026)

ReleasedNov 25, 2021Active support untilNov 25, 2023Security fixes untilDec 31, 2025Last release8.1.34

Check which PHP version your site runs

What PHP 8.1 end of life means

PHP 8.1 was released on November 25, 2021. Active support ended on November 25, 2023, and security support was extended once, to December 31, 2025, under the new rule that support periods end at the close of a calendar year. Since then PHP 8.1 has been end of life.

The practical consequence became clear on October 21, 2026, when the PHP project fixed two critical remote code execution vulnerabilities known as PHP2Shell. PHP 8.2, 8.3, 8.4 and 8.5 got patched releases. PHP 8.1 got nothing. According to W3Techs, about 10% of PHP websites still run 8.1.

If your site is on 8.1, the upgrade is overdue but usually manageable. Most code written for 8.1 runs on 8.4 after fixing a handful of deprecations.

What PHP 8.1 added

The features that made 8.1 worth adopting. Each example opens in the sandbox on PHP 8.1; switch to PHP 8.0 to see it fail.

Enums

Real enumerations with cases, methods, interfaces and backed values. They replaced countless class-constant workarounds.

<?php
enum Status: string
{
    case Draft = 'draft';
    case Published = 'published';

    public function label(): string
    {
        return ucfirst($this->value);
    }
}

$s = Status::from('published');
echo $s->label(), PHP_EOL;
var_dump($s === Status::Published);
echo count(Status::cases());
Run on PHP 8.1 →

Readonly properties

Properties that can be set once, inside the class, and never changed afterwards.

<?php
class Order
{
    public function __construct(public readonly int $id) {}
}

$o = new Order(42);
echo $o->id, PHP_EOL;
try {
    $o->id = 1;
} catch (Error $e) {
    echo $e->getMessage();
}
Run on PHP 8.1 →

First-class callables and new in initializers

strlen(...) creates a closure from any callable, and default values can now use new.

<?php
class Logger { public function log(string $m): void { echo "[log] $m", PHP_EOL; } }

class Service
{
    public function __construct(private Logger $logger = new Logger()) {}
    public function run(): void { $this->logger->log('running'); }
}

(new Service)->run();

$len = strlen(...);
echo implode(',', array_map($len, ['php', 'checker']));
Run on PHP 8.1 →

Fibers, never and array_is_list

Fibers are the building block for async libraries, never marks functions that never return, and array_is_list() checks for 0..n keys.

<?php
$fiber = new Fiber(function (): void {
    $x = Fiber::suspend('paused');
    echo "resumed with $x", PHP_EOL;
});

echo $fiber->start(), PHP_EOL;
$fiber->resume('data');

var_dump(array_is_list([1, 2]), array_is_list([1 => 'a']));
Run on PHP 8.1 →

What breaks when you upgrade from PHP 8.1

These are the changes that most often show up as warnings or errors after moving an 8.1 application to 8.2, 8.3 or 8.4. Open each example on 8.1 and on the newer version to compare.

Dynamic properties are deprecated (8.2)

Assigning a property that was never declared, $obj->foo = 1, raises a deprecation in 8.2+. Declare the property, use #[\AllowDynamicProperties] on the class, or use stdClass. Older WordPress plugins and legacy models hit this a lot.

<?php
class User
{
    public string $name = 'Ada';
}

$u = new User;
$u->email = 'ada@example.com'; // not declared
echo $u->email;

Run on PHP 8.1 →Run on PHP 8.2 →

"${var}" string interpolation is deprecated (8.2)

The forms "${var}" and "${expr}" are deprecated. Use "$var" or "{$var}" instead.

<?php
$name = 'PHP';
echo "Hello ${name}", PHP_EOL;  // deprecated in 8.2
echo "Hello {$name}";            // fine everywhere

Run on PHP 8.1 →Run on PHP 8.2 →

utf8_encode() and utf8_decode() are deprecated (8.2)

They only ever converted Latin-1, which misled many developers. Use mb_convert_encoding($s, 'UTF-8', 'ISO-8859-1').

Implicitly nullable parameters are deprecated (8.4)

function f(Type $x = null) must become function f(?Type $x = null). Automated tools fix this across a project in seconds.

<?php
function find(int $id = null) { return $id ?? 'none'; }
echo find();

Run on PHP 8.1 →Run on PHP 8.4 →

Extensions moved to PECL (8.4)

IMAP, OCI8, PDO_OCI and Pspell are no longer bundled with PHP 8.4. Check php -m on the new version for every extension your application needs.

How to upgrade from PHP 8.1

  1. Confirm the version on every site. Use the PHP Version Checker for public sites, or php -v and phpinfo on the server.
  2. Choose PHP 8.4 or 8.5 as the target. Going only to 8.2 would leave you on an end-of-life version again in two months.
  3. Upgrade dependencies on 8.1 first. Update the CMS, plugins and Composer packages to versions that support your target, so you change one thing at a time.
  4. Run Rector. Its UP_TO_PHP_84 set rewrites most deprecated patterns automatically. Review the diff before committing.
  5. Test on staging with E_ALL. Every deprecation is a line you need to change before PHP 9 turns it into an error.
  6. Switch production, keep a rollback. Change the version in the hosting panel or the FPM pool, and watch the error log closely for the first days.

Not sure whether a piece of code survives the upgrade? The code compatibility checker runs it on PHP 7.4 through 8.5 at once and shows the errors and deprecations for each version. For dates of every other version, see the PHP EOL table.

Free PHP tools

Frequently asked questions

When did PHP 8.1 reach end of life?

On December 31, 2025. It was originally scheduled for November 25, 2024, but was extended when PHP moved all support periods to end on December 31.

Is PHP 8.1 still safe?

No. It did not receive the October 2026 fixes for the critical PHP2Shell vulnerabilities, and it will not receive any future security fixes. The exception is a Linux distribution that backports fixes to its own PHP 8.1 packages; check your distribution's security notices.

Can I upgrade from PHP 8.1 directly to 8.4?

Yes. Skipping versions is fine. The deprecations from 8.2, 8.3 and 8.4 all show up at once, so test on a staging copy first, but there is no need to stop at each version in between.

How do I check if my code works on PHP 8.4?

Paste a file or snippet into the code compatibility checker, which runs it on every version from 7.4 to 8.5 and shows deprecations per version. For a whole project, use PHPCompatibility with PHP_CodeSniffer or PHPStan with the target version set.

Which PHP version do Laravel and Symfony need?

Recent major versions of both frameworks require at least PHP 8.2, so staying on 8.1 also blocks framework upgrades. Check the requirements of the exact version you plan to install.