Sohrab Hejazi
Sohrab Hejazi

Reputation: 1511

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]

Upvotes: 2

Views: 11659

Answers (3)

SANA Abdoul Aziz
SANA Abdoul Aziz

Reputation: 463

If you are on windows and you use wampserver then:

  • Click on wampserver icon at the bottom, right
  • Select Apache
  • Select Apache modules
  • Click on rewrite_module
  • Wait for a minute for wampserver restarting
  • Let's code and enjoy using slim framework API

Upvotes: 0

Cyberwalker
Cyberwalker

Reputation: 31

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

LoadModule rewrite_module modules/mod_rewrite.so

Upvotes: 3

Greg Kelesidis
Greg Kelesidis

Reputation: 1054

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.

Upvotes: 2

Related Questions