vercel-community / php

🐘 PHP Runtime for ▲ Vercel Serverless Functions (support 7.4-8.3)
https://php.vercel.app
MIT License
1.21k stars 268 forks source link

fork: add custom env docroot for php built-in server #516

Closed jeremy93-2008 closed 5 months ago

jeremy93-2008 commented 5 months ago

Hi,

A day ago, I attempted to deploy a Laravel 10.x application on Vercel using your runtime, and I encountered issues with the functionality of the api/ routes in Laravel. Despite PHP not being my primary language (yet!), I delved into the problem for about 2 hours. It turned out that there was an error related to routing and the root folder. The solution was to align the docroot of PHP in the built-in server with the location of api/index.php. This adjustment allowed my api/ routes to function correctly.

In my effort to contribute to this fantastic package, I've created a pull request that introduces the ability to choose the docroot directory through a previously defined environment variable. This modification proved immensely helpful for me. As a result, the latest versions of Laravel now deploy smoothly.

f3l1x commented 5 months ago

Hi @jeremy93-2008. Thank you for your PR.