简体   繁体   中英

Slim framework - 500 Internal Server Error

There is probably a very simple solution to this but I can't seem to figure it out. I'm working a Slim Project which was working fine. I just did a fresh install of Yosemite on my system. I have installed MySQL and enabled PHP (5.5.20). I moved my Slim project under localhost/~username/apiproject .

I get a '500 Internal Server Error' when I try to access my project. I have tried putting a simple html file in the same folder and accessing it via the browser and still get the same error on the HTML file. This tells me that the browser isn't able to access this folder.

Next I tried removing the .htaccess file from the root of the project. When I did that, I was able to access the HTML page which I placed in the folder. However, I am not able to access the project.

I'm assuming this has to be related to my Apache setting or my .htaccess file. I have also enabled mod_rewrite in my Apache settings. Here is what is in my .htaccess file:

RewriteEngine On
RewriteBase localhost/~username/apiproject
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [QSA,L]

我在PHP 5.5.12中遇到了相同的问题,解决方案是取消注释httpd.conf中的以下行:

LoadModule rewrite_module modules/mod_rewrite.so

It is really a simple solution. RewriteBase must begin with a slash (/).
It must be the part of the url after the document root. In this case, I suppose it should be

RewriteBase /apiproject/

If your document root is /localhost, then RewriteBase must be /~username/apiproject/, but the first slash can not be absent.

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