【问题标题】:Shows the Apache directory structure instead of my app显示 Apache 目录结构而不是我的应用程序
【发布时间】:2018-09-18 16:41:19
【问题描述】:

我正在开发我的第一个 CakePHP 项目,我已经完成了以下工作:

  • 从 (http://cakephp.org/) 下载了 CakePHP 源代码
  • 重命名为 sampleapp 并将整个文件夹复制到 /var/www/html
  • sudo /etc/init.d/httpd 重启

当我去http://localhost 时,它会显示正确的 Centos Apache 欢迎页面。但是当我转到http://localhost/sampleapp 时,它会显示目录结构

http://localhost/sampleapp

Parent Directory         -   
app/    05-Jan-2013 14:20    -   
build.properties    05-Jan-2013 14:20   177  
build.xml   05-Jan-2013 14:20   8.6K     
html/   05-Jan-2013 14:20    -   
index.php   05-Jan-2013 14:20   1.4K     
lib/    05-Jan-2013 14:20    -   
plugins/    05-Jan-2013 14:20    -   
vendors/    05-Jan-2013 14:20

我在这里缺少什么?我检查了 .htaccess 文件也在那里

通过一些 SO 研究,我将以下行添加到 /etc/httpd/conf/httpd.conf

AddType application/x-httpd-php .php

并重新启动 Apache,但它没有工作。

我正在使用

  • Apache2
  • CakePHP 2.2.4
  • Centos

【问题讨论】:

    标签: php cakephp apache2


    【解决方案1】:

    首先你应该禁用 Apache 的索引。

    然后确保 Apache 加载了 php。

    httpd -lhttpd -M 并搜索“php”或类似名称。

    我不确定 cake-php,但在 symfony2 中,文档根是 /root-to-page/web

    如果 cake-php 使用 .htaccess 文件,您必须在 vHost 或服务器设置中将 AllowOverride None 更改为 AllowOverride All

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-30
      • 1970-01-01
      相关资源
      最近更新 更多