简体   繁体   中英

Slim PHP 500 Internal Server Error

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!

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

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.

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