简体   繁体   English

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

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

This is my webroot .htaccess file 这是我的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>

This is project folder .htaccess file 这是项目文件夹.htaccess文件

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

This file is in app folder .htaccess file 该文件位于应用程序文件夹.htaccess文件中

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

Can any one help me out with this? 有人可以帮我吗?

Try with below htaccess codes 尝试以下htaccess代码

/var/www/app/webroot/.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 /var/www/app/.htaccess

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

/var/www/.htaccess /var/www/.htaccess

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

There can be following reasons for 500 Internal Server Error in CakePHP application: 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

Hope It Helps, Thanks!! 希望对您有所帮助,谢谢!

暂无
暂无

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

相关问题 我正在尝试在我的本地XAMPP服务器上运行我的Codeigniter项目,但我要么拒绝连接,要么找不到网站或者没有现有域名 - I'm trying to run my Codeigniter Project on my local XAMPP server but I either get connection refused, website not found or not existing domain 如何在Windows的Xampp中设置现有的yii项目 - How to setup existing yii project in xampp on windows 当Cake php项目位于根目录时,如何运行其他php文件? - how to run other php file when cake php project is on root? 如何在没有互联网连接的本地服务器(如xampp)项目上验证php中的到期日期 - How to validate expiry date in php on local server (like xampp) project with no internet connection 如何从xampp上的现有代码运行symfony2项目 - How to run a symfony2 project from existing code on xampp 将现有的Cakephp 3项目设置为本地XAMPP - Setting up existing Cakephp 3 project to local XAMPP 无法在我的本地 Xampp 服务器上使用 php 访问 smarty - Unable to access smarty with php on my local Xampp server 如何使用xampp从本地计算机访问Windows Server 2012 R2上的数据库? - how to access database on windows server 2012 r2 from local machine using xampp? 如何使用网络驱动器中的文件运行本地 Xampp 服务器? - How do I run a local Xampp server using files from a network drive? 如何在zf2中的本地xampp服务器上运行验证码 - How to run captcha on local xampp server in zf2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM