繁体   English   中英

如何在Windows中使用Xampp服务器在本地运行现有的Cake php项目

[英]How to run an existing cake php project in my local using xampp server in windows

这是我的webroot .htaccess文件

<IfModule mod_rewrite.c>
   RewriteEngine On
   RewriteCond %{SERVER_PORT} 80 
    RewriteBase http://localhost/myproject/$1 [R=301,L]
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteRule ^ index.php [L]
</IfModule>

这是项目文件夹.htaccess文件

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

该文件位于应用程序文件夹.htaccess文件中

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

有人可以帮我吗?

尝试以下htaccess代码

/var/www/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>

/var/www/app/.htaccess

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

/var/www/.htaccess

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

CakePHP应用程序中的500 Internal Server Error可能有以下原因:

1) Your .htaccess files are not correct.
2) Permissions of folders are not correct. If CakePHP app is Group Writable i.e. 777 then webserver gives 500 error for safety.
3) You are missing Database Connection. Correct database configuration according to Webhost because most of times local and production server databases have different details.
4) Delete the content of your tmp folder. It is best practice that you must delete cache if you move your application from one place to another.
5) For testing purpose debug should be on like configure::write('debug',2);
6) If not succeeded check your Apache Error Log. If using Linux /var/log/apache2/error.log

希望对您有所帮助,谢谢!

暂无
暂无

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

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