Usama Aslam
Usama Aslam

Reputation: 447

Error 500 when called index.php in laravel application (Windows environment)

I am deploying a laravel application inside windows based docker container using IIS. When I run the application after running docker container the server.php page present at C:\inetpub\wwwroot works fine. However, C:\inetpub\wwwroot\public\index.php returns 500 error. I have enabled the logs, run composer update and applied directory permissions as well. But still no luck.

IIS10 PHP 7.0 Laravel 5.5

The log message is

GET /public/index.php - 80 - 172.18.224.1 Mozilla/5.0+(Windows+NT+10.0;+WOW64;+Trident/7.0;+Touch;+rv:11.0)+like+Gecko - 500 19 13 1

web.config file:

<configuration>

<staticContent>
    <remove fileExtension=".woff" />
    <remove fileExtension=".woff2" />

    <mimeMap fileExtension=".woff" mimeType="application/font-woff" />
    <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^(.*)/$" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Redirect" redirectType="Permanent" url="/{R:1}" />
    </rule>
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^" ignoreCase="false" />
      <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php" />
    </rule>
  </rules>
</rewrite>

Upvotes: 13

Views: 5260

Answers (4)

Keith Becker
Keith Becker

Reputation: 566

A 500 error is a Server Error. Seeing that your server.php page works fine, I would not think anything in your configuration files is causing the error. More likely that not, there is some php code in your index.php page that is causing the error. I suggest using xdebug to step through your code to locate the error.

Upvotes: 0

HM107
HM107

Reputation: 1391

From the top of my head, these are the errors that I faced when setting up laravel:

1- Directory storage permissions

2- Directory bootstrap permissions

3- composer update

4- .env file is available

5- .env key is generated

6- database is there

7- database is configured correctly in .env

8- php artisan serve if the virtual server not configured

and if i got any of those i restart the server to update the values.

if the application was a repo and gave an error, sometimes the below artisan commands save the day:

php artisan cache:clear php artisan route:clear php artisan config:clear php artisan view:clear

Upvotes: 2

Prabakaran T
Prabakaran T

Reputation: 31

You can use the import rule on IIS View Apache Import Rule

Take a look on stackoverflow thread Laravel .htaccess rewrite rule convertion to IIS

If nothing will helpful check the "storage" folder permission in your project. Usually 500 comes with write permission or mis-configuration of server, may be due write permission error, the laravel.log may be empty!

Upvotes: 0

Parvez Mulla
Parvez Mulla

Reputation: 544

500.19 errors usually occur when you have configuration files that are not well formed. Enable Detailed errors in IIS and reproduce the issue. You will get a clear idea as to what is going wrong.

To enable Detailed errors in IIS - Click on the website ---> HTTP Errors--->Edit Feature Settings---->Detailed Errors.

Or you can follow this as well - https://blogs.msdn.microsoft.com/rakkimk/2007/05/25/iis7-how-to-enable-the-detailed-error-messages-for-the-website-while-browsed-from-for-the-client-browsers/

Upvotes: 0

Related Questions