超薄框架 - 500内部服务器错误

时间:2022-10-10 09:52:02

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.

可能有一个非常简单的解决方案,但我似乎无法弄明白。我正在做一个工作正常的超薄项目。我刚刚在我的系统上安装了Yosemite。我已经安装了MySQL并启用了PHP(5.5.20)。我将我的Slim项目移到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.

当我尝试访问我的项目时,我收到“500内部服务器错误”。我已经尝试将一个简单的html文件放在同一个文件夹中并通过浏览器访问它,但仍然在HTML文件中得到相同的错误。这告诉我浏览器无法访问此文件夹。

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.

接下来,我尝试从项目的根目录中删除.htaccess文件。当我这样做时,我能够访问我放在文件夹中的HTML页面。但是,我无法访问该项目。

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:

我假设这必须与我的Apache设置或我的.htaccess文件相关。我也在Apache设置中启用了mod_rewrite。这是我的.htaccess文件中的内容:

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

2 个解决方案

#1


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必须以斜杠(/)开头。它必须是文档根目录后url的一部分。在这种情况下,我认为它应该是

RewriteBase /apiproject/

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

如果您的文档根目录是/ localhost,则RewriteBase必须是/ ~username / apiproject /,但不能缺少第一个斜杠。

#2


I had the same problem in PHP 5.5.12, and the solution is to uncomment the following line in httpd.conf:

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

LoadModule rewrite_module modules/mod_rewrite.so

#1


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必须以斜杠(/)开头。它必须是文档根目录后url的一部分。在这种情况下,我认为它应该是

RewriteBase /apiproject/

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

如果您的文档根目录是/ localhost,则RewriteBase必须是/ ~username / apiproject /,但不能缺少第一个斜杠。

#2


I had the same problem in PHP 5.5.12, and the solution is to uncomment the following line in httpd.conf:

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

LoadModule rewrite_module modules/mod_rewrite.so