简体   繁体   中英

CakePHP application cannot start in localhost

I'm trying to get a CakePHP application to work. I use xampp and put my application files in /xampp/htdocs. For .htaccess configuration I refer to http://book.cakephp.org/1.2/view/37/Apache-and-mod_rewrite-and-htaccess . After that I'm trying to run my application, but I've got this message in browser.

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.

All my other applications in which I have not used the CakePHP, runs well on localhost, without any errors. I think the problem connected with .htaccess. Any suggestions ?

EDITED My .htaccess files

**/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>

I think your .htaccess files look correct. You might need to tell Apache where the webroot of your app is.
Try adding a vhost entry in your Apache configuration

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

try adding something like:

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

The you should then be able to access the CackPHP app by visiting http://localhost
Be sure to remove any other VirtualHost blocks that might conflict, although if you are working with a fresh copy of XAMPP everything in this file will be commented out.
Don't forget to restart Apache for the change to take effect.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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