Run .php routes inside Astro SSR via php-cgi (or php fallback).
npm install astro-php-ssr
Serve PHP under a mount path and allow the PHP dir in Astro
Run .php routes inside Astro SSR via php-cgi (preferred) or php fallback.
- ✅ Works with astro dev/SSR
- ✅ GET/POST supported (basic CGI env)
- ✅ Configurable phpBinary and phpDir
- ⚠️ Requires php-cgi _or_ php on the host
``bash``
npm i astro-php-ssror: yarn add astro-php-ssr
or: pnpm add astro-php-ssr
Click the badge below to see a working demo:

Or fork it to experiment:
The demo shows:
- Basic PHP route integration
- GET/POST request handling
- PHP file serving