Slim PHP in sub directory not working
Question
I have the slim (http://www.slimframework.com/) directory unpacked in http://example.com/api/
and I have the index.php file looking as such:
<?php
require 'Slim/Slim.php';
Slim::init();
Slim::get('/hello/:name', function ($name) {
echo "Hello $name";
});
Slim::run();
?>
but when I try to access the GET method, The browser returns something like:
Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error.
And I have no idea why it's not working.
Help?
Thanks in advance.
Solution 2
Turns out the solution to this problem was HTTP version number within Slim's package.
I changed this line
header('HTTP/1.1 ' . self::getMessageForCode($this->status()));
to
header('HTTP/1.0 ' . self::getMessageForCode($this->status()));
and all was well.
Cheers, thanks for the help.
OTHER TIPS
Did you modify the .htaccess file accordingly and make sure it's in the right spot? Also, try adding this line to it:
RewriteCond %{REQUEST_FILENAME} !-d
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow