duan97689 2019-01-11 17:07
浏览 92
已采纳

当试图在IIS上全新的Grav安装上浏览index.php页面时,我只得到一个“http错误500”页面

I am trying to use Grav CMS (https://getgrav.org/) on a Windows Server 2012 R2 with IIS. I unzip the grav core package and have moved it to my folder named grav in the following location: C:\inetpub\wwwroot\

When i try to launch the site i get the following message to come up:

This page isn't working localhost is currently unable to handle this request. http error 500

If i add a couple of echo outputs in the index.php file then i do get those to appear until the following lines of code that never seem to run and may be what is causing my issue:

// Process the page
try {
    $grav->process();
} catch (\Exception $e) {
    $grav->fireEvent('onFatalException', new Event(array('exception' => 
$e)));
    throw $e;
}

This part seems to be what is causing the page to not load which i dont understand why it is doing so. I can make additional pages and put php code into them and i can render the page without issues.

I am at a loss right now because i made sure all the php modules are enabled and php is installed. I also installed php for IIS and made sure i did the URL rewrite for the htaccess file to a web.config file per the instructions.

Thank you very much for the help.

  • 写回答

1条回答 默认 最新

  • douhuocuo9012 2019-01-17 17:07
    关注

    Figured it out. So I am using PHP 7 and found that a log gets created in the following location C:\Windows\Temp\PHP70x64_errors.log. Once I found that I found I had the following error message:

    Uncaught RuntimeException: Opening file for writing failed on error in C:\inetpub\wwwroot\grav\vendorockettheme\toolbox\File\src\File.php:198

    So this led me to look at the permission page on the Grav site and all of the fixes were for Linux and not Windows but this line caught my eye: The important thing to understand is that there is a potential issue if the user you use to edit your files on the file-system is different from the user that PHP runs under.

    So I then needed to find out what user PHP was running under so I then created a test.php file and added the following:

    <?php 
         echo exec('whoami');
    ?>
    

    Which returned for me nt authority\iusr. So I then gave my whole Grav folder permissions for this user (probably could have just given it write) and voila it worked.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)
  • ¥20 matlab yalmip kkt 双层优化问题
  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多