Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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>

like image 969
Usama Aslam Avatar asked Feb 14 '18 13:02

Usama Aslam


People also ask

How do I fix error 500 in laravel?

If you have a 500 Server Error, just rename the ". env. example" to ". env" and run: – php artisan key:generate – php artisan cache:clear – php artisan config:clear In my case, I pulled the project to Github repo to local machine.

What causes 500 errors PHP?

If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.


1 Answers

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

like image 104
Hamza Mohamed Avatar answered Nov 12 '22 16:11

Hamza Mohamed