Thread: RE: [cgiwrap-users] RE: #!/usr/bin/php
Brought to you by:
nneul
From: Neulinger, N. <nn...@um...> - 2002-08-09 15:24:26
|
Probably the safest way would be: Take the leftmost instance of "/user/script" and replace it with "/script".=20 That's not 100% safe though without comparing against DOCUMENT_ROOT, which is not provided by all servers. (I don't intend to sacrifice cross-platform compatability of cgiwrap, as that is one of it's real benefits.) But should be safe enough for most purposes. -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Neulinger, Nathan=20 > Sent: Friday, August 09, 2002 10:21 AM > To: Daniel Nolte > Cc: cgi...@li... > Subject: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Re PATH_TRANSLATED... I guess i'm just not sure what it's=20 > "supposed" to > be. >=20 > You're saying that the script is physically located at: >=20 > /var/chroot/_nossh/k060881/htdocs/test.php >=20 > and that path translated is set to this by cgiwrap: >=20 > /var/chroot/_nossh/k060881/htdocs >=20 > and is originally this by apache: >=20 > /var/chroot/_nossh/k060881/htdocs/phpmagic.de/k060881/test.php >=20 > I'm willing to change what cgiwrap does, so long as someone=20 > can provide > me a pointer to a reference that says exactly what PATH_TRANSLATED is > supposed to do, assuming that cgiwrap has the necessary information at > the time. >=20 > It does clearly look like it's bogus from cgiwrap. >=20 > I see this definition on one site: >=20 > Definition: A virtual-to-physical mapping of PATH_INFO, which > can be used directly as an absolute path or file, available as an > environment variable for CGI scripts.=20 >=20 > I've also seen this on oreilly's site: >=20 > Besides passing query information to a CGI script, you can also > pass additional data, known as extra path information, as part of the > URL. The extra path information depends on the server knowing=20 > where the > name of the program ends, and understanding that anything > following the program name is "extra." Here is how you would call a > script with extra path information: >=20 > http://some.machine/cgi-bin/display.pl/cgi/cgi_doc.txt >=20 > Since the server knows that display.pl is the name of the > program, the string "/cgi/cgi_doc.txt" is stored in the environment > variable PATH_INFO. Meanwhile, the variable PATH_TRANSLATED=20 > is also set, > which maps the information stored in PATH_INFO to the =09 > document root > directory (e.g., /usr/local/etc/httpd/ public/cgi/cgi-doc.txt).=20 >=20 >=20 >=20 >=20 > That one makes it look like it should be DOCUMENT_ROOT + PATH_INFO. I > can do that if those vars are passed. (I believe they are). >=20 > But is that what y'all think that cgiwrap should set it do? >=20 > Alternatively, I can just leave it alone, and merely strip out the > "/user/" part? >=20 > -- Nathan >=20 > ------------------------------------------------------------ > Nathan Neulinger EMail: nn...@um... > University of Missouri - Rolla Phone: (573) 341-4841 > Computing Services Fax: (573) 341-4216 >=20 >=20 > > -----Original Message----- > > From: Daniel Nolte [mailto:dr...@gm...]=20 > > Sent: Friday, August 09, 2002 10:06 AM > > To: Neulinger, Nathan > > Cc: cgi...@li... > > Subject: RE: #!/usr/bin/php > >=20 > >=20 > > Hi, > >=20 > > > Looks from the output below like the php options didn't=20 > get build or > > > something... Make sure to do a make clean after you configure, and > > make > > > sure that PHP was detected properly when you ran configure. If it > > didn't > > > find php when you ran configure, it would have disabled the php > > > handling. What's configure output look like? > >=20 > > *irghs* > > My fault I did a: " --with-php-path=3D/usr/bin/php4 " instead of > > " --with-php=3D/usr/bin/php4 ". Now it works nearly perfekt. > >=20 > >=20 > > I just have to work a bit on PATH_TRANSLATED. > >=20 > > At the moment:=20 > >=20 > > PATH_TRANSLATED: > > '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/k060881/test.php' > >=20 > > Home Dir: '/var/chroot/_nossh/k060881' > >=20 > > Script Base Directory: '/var/chroot/_nossh/k060881/htdocs' > >=20 > > Script Absolute Path: '/var/chroot/_nossh/k060881/htdocs/test.php' > >=20 > >=20 > > But the real Script Absolute Path is=20 > > /var/chroot/_nossh/k060881/phpmagic.de/test.php > >=20 > > That is PATH_TRANSLATED where the last appereance of the username is > > removed. Is it possible to change that ?:) > >=20 > >=20 > > COMPLETE OUTPUT: *g* > >=20 > > <OUTPUT> > > Initializing Logging > > Redirecting STDERR to STDOUT > >=20 > > Setting SIGXCPU to default behaviour > >=20 > >=20 > > Environment Variables: > > QUERY_STRING: '' > > SCRIPT_NAME: '/cgi-bin/cgiwrap/cgiwrapd' > > SCRIPT_FILENAME: '/usr/lib/cgi-bin/cgiwrap/cgiwrapd' > > PATH_INFO: '/k060881/test.php' > > PATH_TRANSLATED: > > '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/k060881/test.php' > > REMOTE_USER: '<NULL>' > > REMOTE_HOST: '<NULL>' > > REMOTE_ADDR: '80.142.156.229' > >=20 > >=20 > > Trying to extract user from PATH_INFO. > > Retrieved User Name: 'k060881' > >=20 > > User Data Retrieved: > > UserID: 'k060881' > > UID: '1004' > > GID: '2000' > > Home Dir: '/var/chroot/_nossh/k060881' > >=20 > > Script Base Directory: '/var/chroot/_nossh/k060881/htdocs' > > Fetching script string > >=20 > > Trying to extract script from PATH_INFO > > Extracted PATH_INFO 'test.php' > > Building script path > >=20 > > Condensing slashes. > >=20 > > Script Relative Path: 'test.php' > > Script Absolute Path: '/var/chroot/_nossh/k060881/htdocs/test.php' > > Checking for special interpreted script (php). > > Interpreter Path: '/usr/bin/php4' > >=20 > > Fixing Environment Variables. > >=20 > > Environment Variables: > > QUERY_STRING: '' > > SCRIPT_NAME: '/cgi-bin/cgiwrap/cgiwrapd/k060881/test.php' > > SCRIPT_FILENAME: '/var/chroot/_nossh/k060881/htdocs/test.php' > > PATH_INFO: '' > > PATH_TRANSLATED: '/var/chroot/_nossh/k060881/htdocs' > > REMOTE_USER: '<NULL>' > > REMOTE_HOST: '<NULL>' > > REMOTE_ADDR: '80.142.156.229' > >=20 > > Logging Request (File) > >=20 > > UIDs/GIDs Changed To: > > RUID: '1004' > > EUID: '1004' > > RGID: '2000' > > EGID: '2000' > >=20 > > Changing current directory to '/var/chroot/_nossh/k060881/htdocs' > >=20 > >=20 > >=20 > > Output of script follows: > > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > > X-Powered-By: PHP/4.1.2 > > Content-type: text/html > >=20 > > just a test > >=20 > > </OUTPUT> > >=20 > > Bye > > Daniel > >=20 > >=20 > >=20 > >=20 > >=20 >=20 >=20 > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > cgiwrap-users mailing list > cgi...@li... > https://lists.sourceforge.net/lists/listinfo/cgiwrap-users >=20 |
From: Neulinger, N. <nn...@um...> - 2002-08-09 18:06:56
|
go right ahead, it's committed. The doc root approach though is only done in the fallback case.=20 If current (after cvs update) behavior isn't correct, describe how it should be changed. -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Daniel Nolte [mailto:dr...@gm...]=20 > Sent: Friday, August 09, 2002 1:03 PM > To: Neulinger, Nathan > Cc: cgi...@li... > Subject: AW: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Hi >=20 > >I suppose that if the DOCUMENT_ROOT environment variable is=20 > present, I > >can just shortcut, and immediately set it to docroot+pi... I'll try > that > >shortly. >=20 > Wonderfull, any idee when I can test it ?:) *g >=20 > Bye > Daniel >=20 >=20 >=20 |
From: Daniel N. <dr...@gm...> - 2002-08-09 18:23:08
|
Hi, >go right ahead, it's committed. >The doc root approach though is only done in the fallback case. > >If current (after cvs update) behavior isn't correct, describe how it >should be changed. I used cvs -d:pserver:ano...@cv...:/cvsroot/cgiwrap login cvs -z3 -d:pserver:ano...@cv...:/cvsroot/cgiwrap co cgiwrap to get get the source, but the Script Base Directory is still '/var/chroot/_nossh/k060881/htdocs'. Am I using the wrong cvs or does it just take some time until I can access it throug sourceforge? Bye Daniel |
From: Neulinger, N. <nn...@um...> - 2002-08-09 18:24:11
|
Nothing I changed has anything to do with script base directory... If you're having a problem with that, there's something else going on. All I changed was to do with the value of the PATH_TRANSLATED environment variable. -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Daniel Nolte [mailto:dr...@gm...]=20 > Sent: Friday, August 09, 2002 1:23 PM > To: Neulinger, Nathan > Cc: cgi...@li... > Subject: AW: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Hi, >=20 > >go right ahead, it's committed. > >The doc root approach though is only done in the fallback case.=20 > > > >If current (after cvs update) behavior isn't correct, describe how it > >should be changed. >=20 > I used >=20 > cvs -d:pserver:ano...@cv...:/cvsroot/cgiwrap > login > =20 > cvs -z3 > -d:pserver:ano...@cv...:/cvsroot/cgiwrap co > cgiwrap >=20 > to get get the source, but the Script Base Directory is still > '/var/chroot/_nossh/k060881/htdocs'. Am I using the wrong cvs=20 > or does it > just take some time until I can access it throug sourceforge? >=20 > Bye > Daniel >=20 >=20 >=20 >=20 >=20 |
From: Daniel N. <dr...@gm...> - 2002-08-09 18:29:56
|
Hi, The script physical lies in '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/test.php' but at end cgiwrap tries to find it in '/var/chroot/_nossh/k060881/htdocs/test.php' This is the current output. <OUTPUT> Initializing Logging Redirecting STDERR to STDOUT Setting SIGXCPU to default behaviour Environment Variables: QUERY_STRING: '' SCRIPT_NAME: '/cgi-bin/cgiwrap/cgiwrapd' SCRIPT_FILENAME: '/usr/lib/cgi-bin/cgiwrap/cgiwrapd' PATH_INFO: '/k060881/test.php' PATH_TRANSLATED: '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/k060881/test.php' REMOTE_USER: '<NULL>' REMOTE_HOST: '<NULL>' REMOTE_ADDR: '80.142.156.229' Trying to extract user from PATH_INFO. Retrieved User Name: 'k060881' User Data Retrieved: UserID: 'k060881' UID: '1004' GID: '2000' Home Dir: '/var/chroot/_nossh/k060881' Script Base Directory: '/var/chroot/_nossh/k060881/htdocs' Fetching script string Trying to extract script from PATH_INFO Extracted PATH_INFO 'test.php' ***************** * CGIWrap Error * ***************** Script File Not Found! **************************************** * Local Information and Documentation: * **************************************** Web Site: http://www.phpmagic.de Contact Name: WebVector Contact EMail: su...@ph... Contact Web Site: http://support.phpmagic.de **************** * Server Data: * **************** Server Administrator/Contact: web...@ph...> Server Name: phpmagic.de Server Port: 80 Server Protocol: HTTP/1.1 ***************** * Request Data: * ***************** User Agent/Browser: Mozilla/4.0 (compatible; MSIE 5.0; Windows XP) Opera 6.04 [de] Request Method: GET Remote Address: 80.142.156.229 Remote Port: 2169 Extra Path Info: /k060881/test.php </OUTPUT> |
From: Neulinger, N. <nn...@um...> - 2002-08-09 19:03:35
|
I'm assuming /var/chroot/_nossh/k060881 is ~k060881 (home dir)... Since you configured "htdocs" as the cgi dir, when you reference /cgi-bin/cgiwrap/k060881/test.php it should point at the script ~k060881/<cgidir>/test.php which would be ~k060881/htdocs/test.php Hence, the output is correct. -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Daniel Nolte [mailto:dr...@gm...]=20 > Sent: Friday, August 09, 2002 1:30 PM > To: Neulinger, Nathan > Cc: cgi...@li... > Subject: AW: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Hi, >=20 > The script physical lies in > '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/test.php' >=20 > but at end cgiwrap tries to find it in > '/var/chroot/_nossh/k060881/htdocs/test.php' >=20 > This is the current output. > <OUTPUT> > Initializing Logging > Redirecting STDERR to STDOUT >=20 > Setting SIGXCPU to default behaviour >=20 >=20 > Environment Variables: > QUERY_STRING: '' > SCRIPT_NAME: '/cgi-bin/cgiwrap/cgiwrapd' > SCRIPT_FILENAME: '/usr/lib/cgi-bin/cgiwrap/cgiwrapd' > PATH_INFO: '/k060881/test.php' > PATH_TRANSLATED: > '/var/chroot/_nossh/k060881/htdocs/phpmagic.de/k060881/test.php' > REMOTE_USER: '<NULL>' > REMOTE_HOST: '<NULL>' > REMOTE_ADDR: '80.142.156.229' >=20 >=20 > Trying to extract user from PATH_INFO. > Retrieved User Name: 'k060881' >=20 > User Data Retrieved: > UserID: 'k060881' > UID: '1004' > GID: '2000' > Home Dir: '/var/chroot/_nossh/k060881' >=20 > Script Base Directory: '/var/chroot/_nossh/k060881/htdocs' > Fetching script string >=20 > Trying to extract script from PATH_INFO > Extracted PATH_INFO 'test.php' >=20 > ***************** > * CGIWrap Error * > ***************** >=20 > Script File Not Found! >=20 > **************************************** > * Local Information and Documentation: * > **************************************** >=20 > Web Site: http://www.phpmagic.de > Contact Name: WebVector > Contact EMail: su...@ph... > Contact Web Site: http://support.phpmagic.de >=20 > **************** > * Server Data: * > **************** >=20 > Server Administrator/Contact: web...@ph...> > Server Name: phpmagic.de > Server Port: 80 > Server Protocol: HTTP/1.1 >=20 > ***************** > * Request Data: * > ***************** >=20 > User Agent/Browser: Mozilla/4.0 (compatible; MSIE 5.0;=20 > Windows XP) Opera > 6.04 [de] > Request Method: GET > Remote Address: 80.142.156.229 > Remote Port: 2169 > Extra Path Info: /k060881/test.php > </OUTPUT> >=20 >=20 >=20 |
From: Daniel N. <dr...@gm...> - 2002-08-09 19:31:36
|
Hi, > I'm assuming /var/chroot/_nossh/k060881 is ~k060881 (home dir)... Yes, that is right. > Since you configured "htdocs" as the cgi dir, when you reference > /cgi-bin/cgiwrap/k060881/test.php That is also right > it should point at the script Yeap, but since I did not say "--without-script-subdirs" I thought cgiwarp Was able to realize that the script lies in a subdir of htdocs In htdocs/domain (htdocs/phpadmin.de/) Am I wrong with that ? |
From: Neulinger, N. <nn...@um...> - 2002-08-09 19:37:13
|
No... --without-script-subdirs has nothing to do with that. It was a (for the most part pointless) security check that could be enabled to prevent users from storing scripts in subdirectories of cgi-bin.=20 What exactly are you trying to accomplish with the subdir? -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Daniel Nolte [mailto:dr...@gm...]=20 > Sent: Friday, August 09, 2002 2:31 PM > To: Neulinger, Nathan > Cc: cgi...@li... > Subject: AW: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Hi, >=20 > > I'm assuming /var/chroot/_nossh/k060881 is ~k060881 (home dir)... > Yes, that is right. >=20 > > Since you configured "htdocs" as the cgi dir, when you reference > > /cgi-bin/cgiwrap/k060881/test.php >=20 > That is also right >=20 >=20 > > it should point at the script > Yeap, but since I did not say "--without-script-subdirs" I thought > cgiwarp > Was able to realize that the script lies in a subdir of htdocs=20 > In htdocs/domain (htdocs/phpadmin.de/) >=20 > Am I wrong with that ? >=20 >=20 >=20 >=20 >=20 |
From: Daniel N. <dr...@gm...> - 2002-08-09 19:44:26
|
Hi, php scripts normaly not stored in /cgi-bin they are stored everywhere :) e.G. The user has the account "k060881" His homedir would be "/var/chroot/_nossh/k060881" In "/var/chroot/_nossh/k060881/htdocs" he has for every domain he owns a subdir e.G. /var/chroot/_nossh/k060881/htdocs/phpmagic.de or /var/chroot/_nossh/k060881/htdocs/whatever.com So his scripts could be located in /var/chroot/_nossh/k060881/htdocs/HISDOMAIN/somedir/someotherdir/script. php But cgiwrap always removes "HISDOMAIN" e.G. if I request HISDOMAIN.com/somedir/test.php The file is in /var/chroot/_nossh/k060881/htdocs/HISDOMAIN/somedir/test.php but cgiwrap tries to execute the script in /var/chroot/_nossh/k060881/htdocs/somedir/test.php bye Daniel |
From: Neulinger, N. <nn...@um...> - 2002-08-09 20:12:50
|
Sounds like you need to do your rewrite/action something like: Rewrite /....php /cgi-bin/cgiwrap/user/$DOMAIN/$1 i.e. have your action put the domain in the script... I'm presuming you're wanting to share a single cgiwrap installation for all the virtual domains? -- Nathan ------------------------------------------------------------ Nathan Neulinger EMail: nn...@um... University of Missouri - Rolla Phone: (573) 341-4841 Computing Services Fax: (573) 341-4216 > -----Original Message----- > From: Daniel Nolte [mailto:dr...@gm...]=20 > Sent: Friday, August 09, 2002 2:44 PM > To: Neulinger, Nathan > Cc: cgi...@li... > Subject: AW: [cgiwrap-users] RE: #!/usr/bin/php >=20 >=20 > Hi, >=20 > php scripts normaly not stored in /cgi-bin they are stored=20 > everywhere :) >=20 > e.G.=20 > The user has the account "k060881"=20 > His homedir would be "/var/chroot/_nossh/k060881" >=20 > In "/var/chroot/_nossh/k060881/htdocs" he has for every=20 > domain he owns a > subdir e.G. /var/chroot/_nossh/k060881/htdocs/phpmagic.de or > /var/chroot/_nossh/k060881/htdocs/whatever.com=20 >=20 > So his scripts could be located in > /var/chroot/_nossh/k060881/htdocs/HISDOMAIN/somedir/someotherd > ir/script. > php >=20 > But cgiwrap always removes "HISDOMAIN" e.G. if I request > HISDOMAIN.com/somedir/test.php > The file is in > /var/chroot/_nossh/k060881/htdocs/HISDOMAIN/somedir/test.php > but cgiwrap tries to execute the script in > /var/chroot/_nossh/k060881/htdocs/somedir/test.php >=20 > bye > Daniel >=20 >=20 >=20 |