Re: moving from mod_php to mod_fcgid : rewrite problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ben

I'll follow your advice. I'm really grateful for your help, and wish to thank you very very much.

Bye


On 14/02/13 17:02, Ben Johnson wrote:


On 2/14/2013 4:47 AM, Riccardo Cohen wrote:
Hi Ben

Do other PHP scripts function as expected when executed via mod_fcgid?
Or do they all return the error string, "No input file specified" and a
404 response?

Actually my website redirect all urls to /index.php, so there is only
one php file (that loads many others). This way I implement a request
controller easily.

Okay, so if index.php can be accessed and doesn't return a 404, the
problem is not with the CGI setup, as a whole.

My PHP framework functions the same way via mod_php as it does with
mod_fcgid and mod_fastcgi. I achieved this by using a well-known
technique to rewrite the URLs (I place these directives into the
site-root's .htaccess file):

<IfModule mod_rewrite.c>
    RewriteEngine on
    Options All

    # Modify the RewriteBase if you are using a subdirectory and the
    # rewrite rules are not working properly:
    # WARNING: Do not include a trailing slash on this directive if you
    # include a path other than /!
    #RewriteBase /

    # Rewrite URIs of the form 'index.php?q=x' (except for real
    # files/directories):
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>


Yes I understand now that query_string is more portable than path_info.
Thanks for the tip.

You're welcome.


I'm not sure that this is a problem with the PATH_INFO variable since
the error occurs even before php has any chance to start executing (the
test.php is not executed at all in test1)

This may be for the reasons outlined in the article that I cited above.
If you'd like to post your CGI wrapper script, I'd be happy to take a
look. Alas, you may lack access to this script, in which case, it's a
moot point. Although, I must say, it seems unlikely that your host would
have misconfigured the wrapper script. (Then again, we've all seen
worse.)


See the answer of Benoit Georgelin, he kindly added the script to this
thread. Hoping this is the beginning of a solution. I know absolutely
nothing about these wrapper scripts.


I have responded to his message.

As I told him, whatever the source of this problem, it seems to be with
PHP and not Apache.

Here are two PHP bug reports that appear to be relevant, both still open:

Bug #51983 	[fpm sapi] pm.status_path not working when cgi.fix_pathinfo=1
https://bugs.php.net/bug.php?id=51983

Bug #55208 	setting correct SCRIPT_NAME vs PHP_SELF is impossible in
certain circumstances
https://bugs.php.net/bug.php?id=55208

Basically, the consensus is that the cgi.fix_pathinfo directive is a mess.

I wouldn't hold your breath for a resolution. If I were you, I would
take my good advice, use the Query String Append [QSA] flag, and be done
with it for good.

In any case, this discussion should probably be moved to a PHP forum or
mailing list at this point.

Thanks,

-Ben

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



--
Riccardo Cohen
+33 (0)6 09 83 64 49
Société Realty-Property.com
1 rue de la Monnaie
37000 Tours
France

<http://www.appartement-maison.fr>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux