logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache + mod_fcgid and mod_rewrite "No input file speci
Author
thomm



Joined: 26 Dec 2014
Posts: 2
Location: brazil

PostPosted: Tue 11 Aug '15 19:27    Post subject: Apache + mod_fcgid and mod_rewrite "No input file speci Reply with quote

Dev machine configuration:

- Apache 2.4.16 mod_fcgid/2.3.9
- Server API CGI/FastCGI
- Windows 8/10

Goal

My goal is to be able to make a request like:

Code:
http://localhost/test_pathinfo/path/a/b


and have it rewritten to:

Code:
http://localhost/test_pathinfo/path.php/a/b


.htaccess file

Code:
Options -MultiViews
AcceptPathInfo On
RewriteEngine On
RewriteBase /test_pathinfo

RewriteCond %{REQUEST_URI} !\.php
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)(/?)(.*)$ $1.php$2$3 [L]


Test 1

I make a request to: http://localhost/test_pathinfo/path.php/a/b/c

It works completely fine, including being able to access $_SERVER['PATH_INFO']information.

Test 2

I make a request to: http://localhost/test_pathinfo/path/a/b/c

This request returns the error: "No input file specified."

looking the rewrite log for this "Test 2" request...:

Code:
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] add path info postfix: C:/htdocs/test_pathinfo/path -> C:/htdocs/test_pathinfo/path/a/b/c
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] strip per-dir prefix: C:/htdocs/test_pathinfo/path/a/b/c -> path/a/b/c
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] applying pattern '^([^/]+)(/?)(.*)$' to uri 'path/a/b/c'
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] RewriteCond: input='/test_pathinfo/path/a/b/c' pattern='!.+php*' => matched
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] RewriteCond: input='C:/htdocs/path.php' pattern='-f' => matched
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] rewrite 'path/a/b/c' -> 'path.php/a/b/c'
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] add per-dir prefix: path.php/a/b/c -> C:/htdocs/test_pathinfo/path.php/a/b/c
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] trying to replace prefix C:/htdocs/test_pathinfo/ with /test_pathinfo
[rid#e106e871a0/initial] strip matching prefix: C:/htdocs/test_pathinfo/path.php/a/b/c -> path.php/a/b/c
[rid#e106e871a0/initial] add subst prefix: path.php/a/b/c -> /test_pathinfo/path.php/a/b/c
[rid#e106e871a0/initial] [perdir C:/htdocs/test_pathinfo/] internal redirect with /test_pathinfo/path.php/a/b/c [INTERNAL REDIRECT]
[rid#e106e6bd48/initial/redir#1] [perdir C:/htdocs/test_pathinfo/] add path info postfix: C:/htdocs/test_pathinfo/path.php -> C:/htdocs/test_pathinfo/path.php/a/b/c
[rid#e106e6bd48/initial/redir#1] [perdir C:/htdocs/test_pathinfo/] strip per-dir prefix: C:/htdocs/test_pathinfo/path.php/a/b/c -> path.php/a/b/c
[rid#e106e6bd48/initial/redir#1] [perdir C:/htdocs/test_pathinfo/] applying pattern '^([^/]+)(/?)(.*)$' to uri 'path.php/a/b/c'
[rid#e106e6bd48/initial/redir#1] [perdir C:/htdocs/test_pathinfo/] RewriteCond: input='/test_pathinfo/path.php/a/b/c' pattern='!.+php*' => not-matched
[rid#e106e6bd48/initial/redir#1] [perdir C:/htdocs/test_pathinfo/] pass through C:/htdocs/test_pathinfo/path.php


Test 3

Now I make the same request as "Test 2": http://localhost/test_pathinfo/path/a/b/c/d

I just added a /d at the end of the request because I'm not sure if something gets cached, so just to make sure, I added a /d at the end, but the request is basically the same. But before making this request, I changed the .htaccess file and included a R flag, like:

Code:
RewriteRule ^([^/]+)(/?)(.*)$ $1.php$2$3 [R,L]


Now, Apache correctly redirects to http://localhost/test_pathinfo/path.php/a/b/c/d and shows the expected content from path.php

SO why "Test 2" is giving me the "No input file specified"?

I suspect there's something to do with mod_fcgid because this tested fine on a shared hosting account running apache and fastcgi. On stackoverflow someone also tested this on a apache/fastcgi configuration and it worked fine, only on my windows machine running apache+modfcgid that I downloaded here that is giving me this problem.

I installed the whole Apache, PHP, mod_fcgid this month so I haven't done much with the settings and configuration.

httpd.conf

Code:
FcgidInitialEnv PATH "c:/PHP;C:/WINDOWS/system32;C:/WINDOWS;C:/WINDOWS/System32/Wbem;"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/WINDOWS/Temp"
FcgidInitialEnv TMP "C:/WINDOWS/Temp"
FcgidInitialEnv windir "C:/WINDOWS"
FcgidIOTimeout 64
FcgidConnectTimeout 16
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 50
FcgidMaxRequestLen 8131072
# Location php.ini:
FcgidInitialEnv PHPRC "c:/PHP"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
MaxRequestLen 15728640

<Files ~ (\.php)>
  AddHandler fcgid-script .php
  FcgidWrapper "c:/PHP/php-cgi.exe" .php
</Files>
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 12 Aug '15 22:16    Post subject: Reply with quote

I'd be curious if this is also true on *nix
Back to top
thomm



Joined: 26 Dec 2014
Posts: 2
Location: brazil

PostPosted: Thu 13 Aug '15 0:01    Post subject: Reply with quote

I replaced PHP(nts) and mod_fcgid with PHP(ts) and php5apache2_4.dll and the same code is working fine now. Looks like there's something wrong with mod_fcgid.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Thu 13 Aug '15 1:44    Post subject: Reply with quote

I know there is something wrong with mod_fcgid as I got the same results, I'm curious about mod_fcgid on Unix type OSs. It may just be on Windows, or it could be on both. There are a few different source files specific for Unix and Windows. If it's just a "windows thing" it would help someone to maybe find the bug and fix it.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Thu 13 Aug '15 18:09    Post subject: Reply with quote

That is a bug see

https://bz.apache.org/bugzilla/show_bug.cgi?id=52710
https://bz.apache.org/bugzilla/show_bug.cgi?id=40781
Back to top


Reply to topic   Topic: Apache + mod_fcgid and mod_rewrite "No input file speci View previous topic :: View next topic
Post new topic   Forum Index -> Apache