Slim PHP 500 Internal Server Error

2.5k views Asked by At

I'm currently attempting to set up a Slim project with the following directory tree:

public_html
|-- Mini
|-- public
|-- vendor
|-- index.php (Slim)
|-- .htaccess

The document root is public_html, and the contents of the .htaccess are as follows:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]

Despite this seemingly simple structure, I am unable to get anything other than a 500 Internal Server Error when trying to access the domain root or any subdirectories.

This all works on my local WAMP setup.

Any help would be much appreciated!

2

There are 2 answers

0
Julian Laval On BEST ANSWER

Solved!

Issue was tantamount to permissions, and was resolved with the following:

chmod -R u+rwX,go+rX,go-w /path

Found at https://superuser.com/a/91966/334807

0
George On

I am hosting at IONOS on a shared server so my possibilites were somewhat restricted. I tried all of the above and from other forums, but to no success.

The only thing that helped me was to add the full URL to index.php in .htaccess:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ http://my.domain.com/index.php [QSA,L]

However, if you use $basePath in your code to refer to non-script content like images, that will not work anymore. In my case I defined a constant SITE_URL for that purpose.