ufairiya / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Problems with php if root is on a relative path #136

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create folder D:\mongoose. Copy mongoose executable and php folder into
it. Set in mongoose.conf the var cgi_interp as .\php\php-cgi.exe
2. Create a folder called "dev" (D:\mongoose\dev) and put some php files in
it (a simple phpinfo() test file will do)
3. Set root as .\dev
4. Click any php file served by mongoose. PHP will return with "No input
file specified."
5. Click any non-php file served by mongoose. mongoose will work as
expected. Only php fails.
6 Now move the dev folder to D:\ (D:\dev) and set root as D:\dev
7. Click any php file and it should work as expected.

What is the expected output? What do you see instead?
Expected php to function normally but php returned "No input file specified."

What version of the product are you using? On what operating system?
mongoose 2.8, WinXP Professional - fully updated, PHP 5.3.2

Please provide any additional information below.
It looks like php can't handle relative paths or mongoose sends the wrong
info when root is defined on a relative path. I haven't found a way yet to
see the filename that's passed from mongoose to php-cgi.exe

Original issue reported on code.google.com by Azlan....@gmail.com on 21 Apr 2010 at 12:14

GoogleCodeExporter commented 9 years ago

Original comment by valenok on 20 Sep 2010 at 6:25

GoogleCodeExporter commented 9 years ago
FWIW, this has *not* been fixed by #178, easily verifiable by simply starting 
mongoose with the default document root of "." - I need to do use -r $(pwd) to 
make php5-cgi work.

Original comment by elsdoer...@gmail.com on 27 Mar 2011 at 10:07

GoogleCodeExporter commented 9 years ago
To clarify, in order to reproduce the error, if document root is set to ./, 
then scripts in subdirectories, like ./www/index.php say "No input file found". 
./index.php would in fact work.

Original comment by elsdoer...@gmail.com on 29 Mar 2011 at 10:47

GoogleCodeExporter commented 9 years ago
I'm having the same problem.
In order to let PHP work in subdirectories you have to specify the full path as 
document_root.

Would be great if it could be fixed.

Original comment by lieven.r...@gmail.com on 20 May 2011 at 8:24

GoogleCodeExporter commented 9 years ago
Have same problem. Solved it by using a mongoose.bat file instead of 
mongoose.conf since all options can be specified on the command line. My batch 
file is:

mongoose-3.0.exe ^
-C .php ^
-I "%CD%\php-cgi.exe -c %CD% -f" ^
-e merror.txt ^
-i index.php ^
-p 8080 ^
-r %CD%\www

Hope this helps.

Original comment by aschr...@gmail.com on 7 Jan 2012 at 10:54

GoogleCodeExporter commented 9 years ago
If you still want a mongoose.conf file..
then change it's name to install.conf and delete the document_root line.

and create install.bat with that content:
@echo off
type install.conf > mongoose.conf
echo document_root %CD%\root >> mongoose.conf

every time you need to change the location of the app run install.bat after 
moving.

Original comment by eli.sherer on 16 May 2012 at 9:17

GoogleCodeExporter commented 9 years ago
I have combined the mongoose.conf and batch file options and have PHP working 
in a subdirectory. 

The batch file (start_mongoose.bat): 

@echo off

REM PHP requires absolute paths, so some config options are set here. The rest 
are set in the mongoose.conf file.

mongoose-3.3.exe ^
-I "%CD%\php\php-cgi.exe -c %CD% -f" ^
-r "%CD%\www"

EXIT

And mongoose.conf:

cgi_pattern **.php$
# cgi_interpreter ./php/php-cgi.exe # SET IN BATCH FILE - DO NOT UNCOMMENT
error_log_file log/mongoose_errors.log
listening_ports 8080
# document_root www # SET IN BATCH FILE - DO NOT UNCOMMENT

(plus any other options required)

Original comment by hadleyfe...@gmail.com on 9 Nov 2012 at 11:24

GoogleCodeExporter commented 9 years ago
Still not fixed! Please fix this!

Original comment by chase...@gmail.com on 19 Dec 2012 at 6:58

GoogleCodeExporter commented 9 years ago
+1 I got bit by this bug for over 1 hour.

Solution I do is just -r `pwd`/test

Original comment by silas.ba...@gmail.com on 26 Jan 2013 at 1:39