Back in the ZEIT Now days, I wrote a couple of posts about running PHP on “a frontend platform” and shipping tiny serverless endpoints next to static sites:
- https://dev.to/nx1/bleeding-edge-php-on-zeit-now-565g
- https://dev.to/nx1/deploy-static-frontend-php-files-using-zeit-now-mg
- https://community.vercel.com/t/vercel-php/31428
Fast-forward: ZEIT is now Vercel, and the community PHP runtime has matured into a pretty practical way to run PHP on Vercel Functions.
And there’s fresh news: v0.8.0 adds PHP 8.4, and v0.9.0 adds PHP 8.5 🎉
- Runtime repo: https://github.com/vercel-community/php/
- Announcement thread: https://community.vercel.com/t/vercel-php/31428
What shipped
-
vercel-php@0.8.0→ PHP 8.4.x -
vercel-php@0.9.0→ PHP 8.5.x
Why you might care about PHP 8.4 / 8.5
PHP 8.4 is a major language update with features like property hooks, asymmetric visibility, DOM updates, and general performance/cleanup.
Release notes: https://www.php.net/releases/8.4/en.php
PHP 8.5 (released Nov 20, 2025) adds goodies like a built-in URI extension and the pipe operator (|>), plus other improvements.
Release notes: https://www.php.net/releases/8.5/en.php
If you’re deploying micro-APIs, webhooks, “backend-for-frontend” endpoints, or lightweight PHP apps on Vercel, being able to pin a modern runtime version is a big deal.
The runtime in one sentence
vercel-php is a community runtime that runs your PHP code inside Vercel Functions, with Composer support and a bunch of bundled extensions.
Repo: https://github.com/vercel-community/php/
Quickstart: “Hello PHP” on Vercel (PHP 8.5)
Minimal structure:
project/
├─ api/
│ └─ index.php
└─ vercel.json
api/index.php
<?php
header('content-type: application/json');
echo json_encode([
'ok' => true,
'php' => PHP_VERSION,
'sapi'=> php_sapi_name(),
]);
vercel.json (pin PHP 8.5)
{
"functions": {
"api/*.php": { "runtime": "vercel-php@0.9.0" }
}
}
Deploy with the Vercel CLI or the Dashboard. Done.
If you want a canonical “works out of the box” demo, there’s also a tiny landing/demo here:
https://php.vercel.app/
Want PHP 8.4 instead?
Same setup—just change the runtime version:
{
"functions": {
"api/*.php": { "runtime": "vercel-php@0.8.0" }
}
}
“Route everything to index.php” (classic app style)
If you’re adapting a small framework/router or want a single entrypoint:
{
"functions": {
"api/index.php": { "runtime": "vercel-php@0.9.0" }
},
"routes": [{ "src": "/(.*)", "dest": "/api/index.php" }]
}
Composer support (yes)
If you have dependencies:
project/
├─ api/
│ └─ index.php
├─ composer.json
└─ vercel.json
Practical tip: add a .vercelignore and ignore /vendor so you don’t upload it—let the build install deps instead.
Tuning Function limits (duration + memory)
You can configure per-function limits in vercel.json:
{
"functions": {
"api/*.php": {
"runtime": "vercel-php@0.9.0",
"memory": 1024,
"maxDuration": 60
}
}
}
Note: Duration limits depend on your Vercel plan and whether features like Fluid Compute are enabled.
Docs: https://vercel.com/docs/functions/configuring-functions/duration
Overriding php.ini
Need custom INI settings? Drop a php.ini next to your handlers:
api/
├─ index.php
└─ php.ini
Example:
memory_limit=1024M
disable_functions="exec,system"
A couple of gotchas
-
Local dev: the runtime ecosystem historically hasn’t been perfect with
vercel devin every setup. If you hit issues, the simplest fallback is using PHP’s built-in server locally and treating Vercel as your deploy target. -
Config file choice: Vercel supports
vercel.jsonorvercel.ts(programmatic), but you typically use one configuration approach per project. Docs: https://vercel.com/docs/projects/project-configuration
Upgrading from older pins
If you’re already using vercel-php, upgrading is often just changing the runtime string:
-
vercel-php@0.7.x→vercel-php@0.8.0(PHP 8.4) -
vercel-php@0.8.x→vercel-php@0.9.0(PHP 8.5)
Then:
- make sure your
composer.jsonPHP constraint matches (e.g.^8.4/^8.5) - run tests
- deploy to a Preview URL and hit the endpoints
Links
- Runtime repo: https://github.com/vercel-community/php/
- Announcement thread: https://community.vercel.com/t/vercel-php/31428
- Demo: https://php.vercel.app/
- PHP 8.4 release notes: https://www.php.net/releases/8.4/en.php
- PHP 8.5 release notes: https://www.php.net/releases/8.5/en.php
- Vercel function duration: https://vercel.com/docs/functions/configuring-functions/duration
- Vercel project configuration: https://vercel.com/docs/projects/project-configuration
Top comments (0)