Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
URL appearing in GET array
  • For some reason, I have (most of) the request uri turning up in the Input::get() array.

    My site is located at http://www4.wlv.ac.uk/btw, which points to my /public folder. If I go to http://www4.wlv.ac.uk/btw/texts/1001, my Input::get() array is
        Array
        (
            [/texts/1001] => 
        )

    In Input::server(), I can see I have [PHP_SELF] => /btw/index.php and [QUERY_STRING] => /dev/system, which seems wrong. Some other values seem strange also (eg [REDIRECT_FUEL_ENV] => production, strange [DOCUMENT_ROOT] etc), but I don't want to post other values publicly (I can send them privately).

    It's a newly configured server, so there might be something amiss in the server configuration.

    Have you any idea what might be the cause, and/or what I could do within FuelPHP or request of the server administrator to resolve this?

    Thanks, Chris
  • Nginx? Sounds like it, with an incorrect redirect.
  • Thanks, Harro. The sysadmin says:

    Whilst we’re using Apache here, PHP is running over FastCGI which makes it behave similarly to an nginx install. Since PHP isn’t directly integrated into the Apache request pipeline, it doesn’t get access to the internal variables – which means it doesn’t get the pre-mod_rewrite URL. All it gets is the complete URL after rewriting, so for http://www4.wlv.ac.uk/btw/texts it will only see http://www4.wlv.ac.uk/btw/index.php?/texts and set the $_SERVER variables accordingly.

    This gave me sufficient clue to go to the .htaccess, where I removed the question mark from the Apache FCGI rewrite (ie index.php/$1 in place of index.php?/$1).

    Everything appears to be good now.

    Thanks, Chris
  • So you're not using the htaccess that is supplied by the framework? Because that has built-in support for all different apaches setups, including FastCGI.
  • Yes, I'm using the .htaccess supplied by the framework (v1.7.1).

    It includes the following rules:
    • <IfModule mod_fcgid.c>: RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    • <IfModule mod_php5.c>: RewriteRule ^(.*)$ index.php/$1 [L]
    • <IfModule !mod_php5.c>: RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
    In the last of these (labelled for Apache FGCI installations), I removed the '?', and [QUERY_STRING] was then correct.

    Using redirect rules specific to different Apache installations is way above my head!
  • Very odd.

    I have a Synology NAS here that I use for test purposes, since it runs both Apache and Nginx with FCGI, and that exact line works fine here.

    So there must be something non-standard in your server setup somewhere...
  • Harro, I can well believe it (newly configured server in new production role). I can check for further details with the sysadmin if it might be helpful to you, but otherwise it's now working fine for me!
  • Thanks.

    If we know what caused it, we can add it to the docs, or change the framework or the rewrite rules to deal with it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion