I have been developing a Slim back-end using Wampserver on Windows 10 and it works like a charm. However, the time has come for me to move the back-end to a server running Ubuntu 16.04. I did this using git but I am unable to access any of my Slim URLs, for example:
$app->get(’/api/test/get’, function (Request $request, Response $response) {
return $response->getBody()->write(“GET request successful”);
});
This should return a simple echo but it does not, I get a ‘Not found’-error page. When I try to access /index.php I see that the error page looks like its from the Slim framework which is interesting. Both these error pages can be seen here:
Error page screen dumps: https://imgur.com/a/uHucA
I suspect that there is an issue with how I have configured Slim and/or Apache. I have tried accessing webpages on my server that are not connected to Slim and they work fine. Online I read that I need to add ‘AllowOverride All’ to the Apache config files, and so I did to all of them where I saw fit.
I have configured the web root directory correctly so it is not that. Could it be a problem if I run PHP 7.0 on the server but I developed slim in PHP 5.5? But wouldn’t that just lead to syntax errors and not these 404’s?
I am very confused, if you have any clue I would love a hand. Please don’t hesitate to request to see any kinds of code and I will post it right away.
Thanks!
EDIT: I feel as if I wrote this kinda messy so heres a summary:
- I wrote my slim back-end in win10 Wampserver PHP5.5
- I now moved it to a server running Ubuntu 16.04
- I tried to configure Apache correctly (‘AllowOverride All’ where it was needed, and change web root directory)
But now - I cannot access any slim page, it just returns “not found”
- Upon running ‘composer diagnose’ I get some errors
Screen dumps: https://imgur.com/a/uHucA
EDIT 2: Apparently ‘/index.php/hello/john’ works, but ‘/hello/john’ doesn’t. I read that it is due to .htaccess and apache conf files being incorrectly configured, hmm…