2012-04-21 116 views
2

我试图让CakePHP应用程序工作。我使用xampp并将我的应用程序文件放在/ xampp/htdocs中。对于.htaccess配置我参考http://book.cakephp.org/1.2/view/37/Apache-and-mod_rewrite-and-htaccess。之后,我试图运行我的应用程序,但我在浏览器中收到了此消息。CakePHP应用程序无法在本地主机上启动

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. 

我没有使用CakePHP的所有其他应用程序,在本地主机上运行良好,没有任何错误。我认为这个问题与.htaccess有关。有什么建议么 ?

EDITED 我的.htaccess文件

**/xampp/htdocs/app/webroot/.htaccess** 

<IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 
</IfModule> 

**/xampp/htdocs/app/.htaccess** 

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ webroot/ [L] 
    RewriteRule (.*) webroot/$1 [L] 
</IfModule> 

**/xampp/htdocs/.htaccess** 

<IfModule mod_rewrite.c> 
    RewriteEngine on 
    RewriteRule ^$ app/webroot/ [L] 
    RewriteRule (.*) app/webroot/$1 [L] 
</IfModule> 
+1

你的apache的错误日志说什么? – ThiefMaster 2012-04-21 13:19:09

+0

其他meesages大约港口80,443 ... [Sat Apr 21 17:24:47 2012] [alert] [client 127.0.0.1] C:/xampp/htdocs/follow/app/webroot/.htaccess:< IfModule接受一个参数,Container for指令基于指定模块的存在 – emilan 2012-04-21 13:26:11

+0

在[this article](http://codeigniter.com/forums/viewthread/82647/P45)与CodeIgniter相关,似乎暗示了字符编码'.htaccess'可能是问题。看一看,看看能否帮到你。 – 2012-04-21 18:46:40

回答

0

我觉得你的.htaccess文件看起来是正确的。您可能需要告诉Apache您的应用程序的webroot位置。
尝试添加在你的Apache配置的虚拟主机条目

\xampp\apache\conf\extra\httpd-vhosts.conf

尝试添加类似:

<VirtualHost *:80> 
    ServerName localhost 
    DocumentRoot c:\xampp\htdocs\app\webroot <-(use the actual path here) 
</VirtualHost> 

的,那么你应该能够访问http://localhost
一定要访问CackPHP应用删除可能冲突的任何其他VirtualHost块,但如果您正在使用XAMPP的全新副本,则该文件中的所有内容都将被注释掉。
不要忘记重启Apache以使更改生效。

相关问题