I'll state my questions first and then do the explanition later on.
Questions:
- Why is Phalcon adding
_url
toQUERY_STRING
and using it for routing as opposed to usingREQUEST_URI
and stripping query params from it? - If above is how routing is done when why is it not the behavior of Phalcon 2, should I report it as a bug?
- I am also interested in knowing what else is being modified in global vars by Phalcon?
Scenario
I have setup Phalcon2, php56 (from remi) and nginx using php-fpm and first thing I noticed that none of the routes were working. After comparision of $_SERVER
with phalcon 1.3.4 that I had running on another box, I found that Phalcon 1.3.4. modifies QUERY_STRING
by adding _url
which is then used for routing.
To demonstrate this consider the following urls and QUERY_STRING
values:
- https://domain.com/ ->
QUERY_STRING
=_url=/
- https://domain.com/controller/action/params1 ->
QUERY_STRING
=_url=/controller/action/params1
- https://domain.com/controller/action/params1?get=1 ->
QUERY_STRING
=_url=/controller/action/params1&get=1
So I had to hack my nginx config to modifity QUERY_STRING
as following and I am back in business
location / {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param PHP_SELF index.php;
fastcgi_param KAPI_ENV prod;
# This is required for Phalcon Routing..
fastcgi_param QUERY_STRING _url=$document_uri&$query_string;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
}