mrjgreen/phroute

Blank Pages

wkolcz opened this issue · 3 comments

I set up an index.php page, imported the library, set it up the same way as the example. I set up the nginx as described and the same way I had other frameworks that used routers. But when I go to the URL via the browser I get blank pages.

I tried the example with the dispatch and it seems like it works but not when the pages are hit through the url. What am I missing?

same issue.

here is my .htaccess configuration

RewriteEngine on
RewriteCond  %{REQUEST_FILENAME} !-f
RewriteCond  %{REQUEST_FILENAME} !-d
RewriteRule  ^(.*)$ index.php [QSA,L]

i use php 5.6 via docker-php official container and i also tried slim framework to see if there is anything wrong with my container. but slim works fine.

MrApe commented

I've had a similar error and putting a try_files directive to my nginx.conf at the webapp location worked:

location /app/ {
   try_files $uri $uri/ /app/app.php?$args;
}

You need to use

$dispatcher = new Phroute\Phroute\Dispatcher($router->getData());
$response = $dispatcher->dispatch($_SERVER['REQUEST_METHOD'], parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
echo $response;

after the announcement routers