2016-11-25 146 views
1

我有一个使用Laravel 5.2和PHP 7.我是,有时当我浏览该网站,我得到了错误的问题上微软Azure的应用服务:Laravel和Azure的错误:内部服务器错误

this page cannot be displayed because an internal server error has occurred

这种情况是随机发生的,但是当它发生时它会阻止路线,例如我浏览没有问题的地址http://elsitio.com/details/12然后我再次单击并引发错误。

为了摆脱错误,我必须重新启动应用服务,它会正常工作,所以我认为它与应用中的视图缓存有关。

除了设置Laravel .env我还没有做任何配置。

使用phpinfo我发现该网站似乎在FastCGI上运行,但我不太确定,因为显示的错误似乎是由IIS管理的。

我的问题是:

  1. Any ideas on what may be causing the problem?

  2. How can I restart FastCGI/IIS service without restarting the App Service, for example in Apache over Linux would be service httpd restart .

更新1

这是一个非常奇怪的错误,有时我得到一些COMPONENTES缺少错误:Interface 'Illuminate\Contracts\Queue\QueueableCollection' not found然后我做$: composer install并开始工作,然后我重新加载页面,我得到与缺失组件有关的另一个错误。

如果我改变PHP版本,它再次开始工作:(。

+0

它煤层您在ENV文件'APP_DEBUG = FALSE'已经设置,你不能看到实际的错误。也可以添加你的''。env'(没有关于数据库连接的信息) – Kliment

+0

APP_DEBUG设置为true :) – JohnnyAce

回答

1

通常情况下,当你得到一个500 HTTP错误,这意味着你可能会出现一个PHP致命错误。你可以使显示的错误配置对诊断错误。同时,考虑到你所面临的随机问题,您还可以启用错误日志,用于跟踪问题。

您可以参考Info About PHP Fatal Error and Error Log on Azure Website获得更多信息。您也可以参考How to: Change the built-in PHP configurations

如有任何问题,请随时通知我。

+0

这是一个非常奇怪的错误,有时我得到某些Laravel元素丢失:'Interface'Illuminate \ Contracts \ Queue \ QueueableCollection'not找到'然后我做$:作曲家安装,它开始工作,然后再次工作,然后我重新加载页面,我得到另一个错误。如果我更改PHP版本,它开始再次工作:( – JohnnyAce

1

我在迁移到Azure时遇到了问题,即在运行composer install时,Composer不会拉动某些文件。尝试手动下载文件 from here并运行composer dump-autoload

0

如果一切正常完成,只需执行以下操作。

  1. 创建一个web.confpublic
  2. 复制下面的代码。

    <configuration> 
        <system.webServer> 
        <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> 
        </system.webServer> 
    </configuration>