dongmi3203 2018-07-09 22:05
浏览 70
已采纳

Yii2:无法执行申请。 Apache显示“索引”

I developed a Yii2 application that works in my computer with Debian.

Then I installed Bitnami WAPP in a computer with Windows 8 and I tried to execute it but it doesn't work. It shows the content like a folder instead of execute the code:

Index of instead of executing

I thought that Apache was having a problem and it can't execute PHP, so I tried to execute a basic example and it works perfect:

<?php 
  phpinfo(); 
?>

Basic PHP example executed successfully

UPDATE: I think the problem was a wrong address. But now it shows this error:

Error 500 I hope all this information can help.

Apache log:

[Thu Jul 12 08:22:35.576377 2018] [php7:warn] [pid 5100:tid 1004] [client ::1:56103] PHP Warning:  require(C:\\Bitnami\\wappstack-7.1.19-0\\apache2\\htdocs\\donaciones-yii\\backend\\web/../../vendor/autoload.php): failed to open stream: No such file or directory in C:\\Bitnami\\wappstack-7.1.19-0\\apache2\\htdocs\\donaciones-yii\\backend\\web\\index.php on line 5
[Thu Jul 12 08:22:35.576377 2018] [php7:error] [pid 5100:tid 1004] [client ::1:56103] PHP Fatal error:  require(): Failed opening required 'C:\\Bitnami\\wappstack-7.1.19-0\\apache2\\htdocs\\donaciones-yii\\backend\\web/../../vendor/autoload.php' (include_path='.;C:/Bitnami/wappstack-7.1.19-0/php/PEAR') in C:\\Bitnami\\wappstack-7.1.19-0\\apache2\\htdocs\\donaciones-yii\\backend\\web\\index.php on line 5

Apache access.log:

::1 - - [12/Jul/2018:08:22:35 -0300] "GET /donaciones-yii/backend/web/ HTTP/1.1" 500 -

donaciones-yii/backend/web/index.php:

<?php
defined('YII_DEBUG') or define('YII_DEBUG', false);
defined('YII_ENV') or define('YII_ENV', 'dev');

require(__DIR__ . '/../../vendor/autoload.php');
require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
require(__DIR__ . '/../../common/config/bootstrap.php');
require(__DIR__ . '/../config/bootstrap.php');

$config = yii\helpers\ArrayHelper::merge(
    require(__DIR__ . '/../../common/config/main.php'),
    require(__DIR__ . '/../../common/config/main-local.php'),
    require(__DIR__ . '/../config/main.php'),
    require(__DIR__ . '/../config/main-local.php')
);

(new yii\web\Application($config))->run();
  • 写回答

2条回答 默认 最新

  • dongshi9407 2018-07-10 05:12
    关注

    You are opening a folder on your WAPP that is not meant to be opened in browser.

    Your public application for the browser is most probably located in:

    http://localhost/frontend/web/

    and: http://localhost/backend/web/

    These are the folders that you should be checking and that should work.

    Opening just http://localhost/ is not meant for serving publicly and what you see is expected behavior.

    in a production scenario you would need to set your DocumentRoot to eg "/var/www/frontend/web" so you would have only the relevant folder served to public

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿