Search code examples
laraveliishttp-status-code-500

Laravel 9 on IIS returns 500 server error when "php artisan serve" on same server works


I am trying to deploy a Laravel 9 site onto an IIS Server (and no, I don't have the option of using a Linux server). If I run the local server setup with "php artisan serve", it works fine through 127.0.0.1 on the server, including all calls to the database.

However, if I try to run the site through the IIS server via its domain name, I get a 500 server error. Failed Response Tracing shows a FASTCGI_UNKNOWN_ERROR: "The directory name is invalid. (0x8007010b)"

Error Screenshot

The DNS is functioning properly as I have tested a phpinfo page on it.

Is there a configuration in IIS I need to set in order for the Laravel site to work?


Solution

  • It turned out I didn't have my php-cgi.exe file mapped accurately in IIS. I had to edit my Handler Mappings and link the FastCgiModule handler to my current installment of PHP, mapping it to the php-cgi.exe file.