Skip to content
zefıly
← All posts

Laravel on Ubuntu 26.04: PHP-FPM or Octane with FrankenPHP?

5 min read

Two ways to run Laravel 13 in production. What each one is, what we measured on the same machine, what Octane asks of your code, and a plain recommendation for which to choose. Tested on Ubuntu 26.04 with PHP 8.5.

There are two serious ways to run Laravel today. PHP-FPM is the classic one: nginx hands each request to a PHP worker, which loads the framework, answers, and forgets everything. Laravel Octane with FrankenPHP keeps the application loaded in memory between requests, so the framework boots once instead of every time.

We set up both on the same fresh Ubuntu 26.04.1 system on 12 November 2026, with a new Laravel 13.42 project.

In short

  • PHP-FPM is the safe default. Every Laravel package works, and nothing leaks between requests.
  • Octane removes the framework's boot time from each request. The gain is real when your own code is fast, and small when the request waits for the database anyway.
  • In our quick test on Laravel's default page, Octane answered 169 requests per second and PHP-FPM 144. That is 17% more, not ten times more.
  • Octane keeps state in memory. Code that was never written for that can leak data between requests.
  • Start with PHP-FPM. Move to Octane when you have measured that boot time is your problem.

What is installed

Ubuntu 26.04 has what Laravel 13 needs. A new project asks for PHP ^8.3; the archive has PHP 8.5.

sudo apt-get install nginx php8.5-fpm php8.5-cli php8.5-mbstring php8.5-xml \
  php8.5-curl php8.5-zip php8.5-bcmath php8.5-intl php8.5-sqlite3 composer
composer create-project laravel/laravel app

Option 1: PHP-FPM

server {
    root /srv/app/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.5-fpm.sock;
    }
}
php artisan optimize

Two settings decide how it performs:

  • OPcache keeps compiled PHP in memory. In PHP 8.5 it is always part of PHP, and it was on in our test without any change.
  • pm.max_children is how many requests PHP can work on at the same time. Ubuntu's default is 5. That is low for a busy site, and too high for a 1 GB server if every worker uses 100 MB. Set it from your memory: (memory you can give to PHP) ÷ (memory of one worker).

Option 2: Octane with FrankenPHP

composer require laravel/octane
php artisan octane:install --server=frankenphp
php artisan octane:start --server=frankenphp --host=127.0.0.1 --port=8000 --workers=4

octane:install downloads the FrankenPHP binary into the project. In our test that was FrankenPHP 1.13.5, a single file of about 180 MB, with Octane 2.24.

Three things we noticed, which the short tutorials leave out:

FrankenPHP brings its own PHP. The binary reported PHP 8.5.12, while the system's PHP was 8.5.4. Your application does not run on the PHP you installed with apt. Extensions you add with apt install php8.5-… are not in it; the binary has its own built-in set. Check that everything your app needs is there:

./frankenphp php-cli -m

It wants a writable home. Started as www-data, which has no usable home directory, it logged:

ERROR  could not clean default/global storage.
ERROR  unable to create folder for config autosave.

It still served requests, but run it as a user with a real home directory, or set XDG_DATA_HOME and XDG_CONFIG_HOME to writable folders.

Keep nginx in front. Run Octane on 127.0.0.1 and let nginx serve the files in public/ and pass the rest on. You keep one place for HTTPS, limits and logs.

What we measured

Same machine, Laravel's default welcome page, ab with 2,000 requests, 20 at a time:

Requests per second Mean time per request
nginx + PHP-FPM (5 workers, Ubuntu default) 144 138 ms
Octane + FrankenPHP (4 workers) 169 118 ms

Please read this as a rough check, not a benchmark. It was one run, in a container, with different worker counts, on a page that also writes a session to SQLite. A tuned setup of either kind does better.

The point is the size of the difference. Octane saves the boot time of the framework, which is a few milliseconds per request. If the rest of the request takes 100 ms, the page is not much faster. If your endpoints are already fast (an API that answers from cache), the saving is a large share and the gain is large.

What Octane asks of your code

With PHP-FPM every request starts from zero. With Octane the application object lives on. Things that were harmless become bugs:

  • A static property or singleton that stores something about the current user is still there for the next visitor.
  • An array that grows on every request is a memory leak.
  • Code that reads configuration into a singleton at boot does not see later changes.
  • After a deployment the workers still run the old code until you reload them: php artisan octane:reload.

Laravel itself resets its own state between requests. Your code and your packages are your responsibility. Run your test suite, and watch memory per worker for a few days.

Which one?

Choose PHP-FPM if:

  • you are launching and have no measurements yet,
  • the app uses many third-party packages you have not checked for Octane,
  • several different PHP applications share the server.

Choose Octane if:

  • you measured that framework boot is a real share of your response time,
  • your team can test for state leaks,
  • you want long-lived features such as concurrent tasks.

Moving from one to the other later is a deployment, not a rewrite. Starting simple costs you nothing.

With Zefily

Zefily runs Laravel sites on PHP-FPM by default, each site as its own Linux user in its own pool, with the queue worker and scheduler as managed services. When you want Octane, the site's Deploy pane has an Octane (FrankenPHP) card: add laravel/octane to your repository, click Enable Octane, and Zefily installs a pinned, checksum-verified FrankenPHP, starts it as your site user on a local port and points the web server at it. If the app does not answer, the site goes back to PHP-FPM. See Laravel.

Frequently asked questions

Is FrankenPHP faster than PHP-FPM for Laravel?

Per request it saves the framework's boot time. In our quick test on Laravel's default page Octane with FrankenPHP served 169 requests per second and PHP-FPM 144. The gain is larger for endpoints that are already fast.

Does FrankenPHP use the PHP installed on my server?

No. The FrankenPHP binary contains its own PHP. In our test it was PHP 8.5.12 while the system had 8.5.4, and extensions installed with apt are not part of it.

Does my Laravel app work with Octane without changes?

Often, but not always. Code that keeps per-request data in static properties or singletons can leak it into the next request. Test before switching.

What PHP version does Laravel 13 need?

A new Laravel 13 project requires PHP 8.3 or newer. Ubuntu 26.04 ships PHP 8.5.

How many PHP-FPM workers should I set?

Divide the memory you can give to PHP by the memory of one worker. Ubuntu's default pm.max_children is 5.

See PHP settings for tuning PHP in Zefily.

More posts

Black Friday & Cyber Monday

Before you go: lifetime plans are on sale

Pay once for a lifetime plan, or get 30% off the first year of any yearly plan.

Only 100 lifetime plans per plan. When they are gone, they are gone.

See the campaign

Amazing November

See the campaign →