Clarification on configuring PHP project without output directory
Hi,
I’m experimenting with the Vercel PHP runtime. I noticed that when deploying a project with only a PHP entrypoint (e.g., api/index.php) and no static files the vercel command gives the error Error: No Output Directory named "public" found after the Build completed
Since serverless PHP functions don’t need a static output directory, I wanted to clarify:
What is the recommended way to configure a purely PHP project with no static output directory?
I did follow the instructions at https://php.vercel.app/ but this also gives the same error.
Any guidance or example minimal setup would be very helpful.
Thanks!
Could you share a minimal reproduction repository and your deployment logs? That would help determine whether this is a configuration issue or a bug in the PHP runtime.
That error comes from Vercel's build step, not the PHP runtime. After the build it looks for a static output folder (public by default), and a functions-only project doesn't have one. Two fixes work. One is to add an empty public/ folder with a .gitkeep (or a tiny index.html) and commit it. The other is to open Project Settings, then Build and Deployment, set the Framework Preset to "Other", and leave Build Command and Output Directory empty, so Vercel only builds the functions from vercel.json. Keep your functions entry for api/*.php using the runtime version from php.vercel.app, and add a route to /api/index.php if you want every path to hit it. More detail on this error: https://getfixstack.com/errors/vercel-no-output-directory/?ref=gh