简体   繁体   English

显示Apache目录结构而不是我的应用程序

[英]Shows the Apache directory structure instead of my app

I am working on my first CakePHP project, and I have done the following: 我正在做我的第一个CakePHP项目,并且已经完成了以下工作:

  • Downloaded the CakePHP source from ( http://cakephp.org/ ) 从( http://cakephp.org/ )下载CakePHP源代码
  • rename to sampleapp and copy the entire folder to /var/www/html 重命名为sampleapp并将整个文件夹复制到/ var / www / html
  • sudo /etc/init.d/httpd restart sudo /etc/init.d/httpd重新启动

And when I go http://localhost it shows the correct Apache welcome page for Centos. 当我进入http://localhost它将显示Centos的正确Apache欢迎页面。 But when I go to http://localhost/sampleapp it shows me the directory structure 但是当我转到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

What am I missing here? 我在这里想念什么? I have checked that the .htaccess file is also there 我检查了.htaccess文件是否也在那里

With some SO research I added the following line to /etc/httpd/conf/httpd.conf 通过一些SO研究,我/etc/httpd/conf/httpd.conf下行添加到/etc/httpd/conf/httpd.conf

AddType application/x-httpd-php .php

and restart the Apache but it didn't work. 并重新启动Apache,但没有成功。

I'm using 我正在使用

  • Apache2 阿帕奇2
  • CakePHP 2.2.4 CakePHP 2.2.4
  • Centos Centos

First of all you should disable the Indexes of Apache. 首先,您应该禁用Apache的索引。

After that make sure php is loaded by Apache. 之后,确保php由Apache加载。

httpd -l and httpd -M and search for 'php' or similar. httpd -lhttpd -M并搜索“ php”或类似名称。

I am not sure about cake-php but in symfony2 the document-root is /root-to-page/web 我不确定cake-php,但在symfony2中,文档根目录为/root-to-page/web

And if cake-php uses .htaccess files you must change AllowOverride None to AllowOverride All in your vHost or Server settings 而且,如果cake-php使用.htaccess文件,则必须在vHost或Server设置中将AllowOverride None更改为AllowOverride All

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM