Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
As root you can see the PATH variable for any running process in the /proc directory. Here is what you need to do: 1. su to root 2. run the command ps -e | grep httpd which will show you all of process ids for apache 3. cd to /proc and do an ls. You should see a directory with the same number as each of the httpd process ids 4. cd to one of those directories and then cat the environ file. The information is just one long sting and not nicely formated, but PATH should be obvious. Sil Steve Pelikan wrote: Just having suexec loaded shouldn't make any difference because(AFAIK) it isn't actually used unless you explicitly request its use. Good point. Okay, in a perl cgi script run by version 2.2 the command system(ls) returns an error code (256, as I recall which corresponds to actual exitcode 1) which I can print after the system(ls) call. Using apache 2.0 the perl statement system(ls) returns 0 as it should. Using a nonsense command system(foo); produces an error code of -1 with both 2.0 and 2.2 An additional bit of info that suggests there's a path/permissions problem is that perl cgi scripts run with the apache 2.2 report an error with a require(/home/pelikan/test.txt); (can't find file) but can do require(/var/www/cgi-bin/test.txt); As if whoever's running the script can see cgi-bin but not /home/pelikan (though the /home/pelikan is set to let anyone read and execute) The file test.txt exists in both places. Apache runs as user 'apache' and there's no login allowed for that user so I don't know how to run a program or view the path for user apache. I'll read up on how to do cron and see if I turn that into a test. THanks! Steve P Steve Swift wrote: - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
My only experience with apache under linux is with redhat, so there may be subtle differences. In order to execute ls then the userid:group under which apache runs needs at least two things: 1. Execute access to the executable (typically /bin/ls) 2. To have the path to the executable (/bin in this case) in the PATH environment variable. There may be additional restrictions on accessing/executing the /bin/ls command. Can you logon as the user/group and execute the ls command? This is inconclusive if it works as the environment may be different. It would probably be a better test if you could issue the ls command from a cron task running on behalf of the userid:group that you use in apache. Additionally, are you using suexec? I'm suspect there are other restrictions if you do, maybe. On 10/02/07, Steve Pelikan [EMAIL PROTECTED] wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. system(ls); returns an error with version 2.2 but runs w/o error with 2.0 Same with File::Copy copy() function. I believe I've made the configurations (httpd.conf) for the two apaches the same. What am I'm missing? Thanks Steve P - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
I have seen that the default user/group of Apache has changed. Does that user have access for running the programs you want? Octavian - Original Message - From: Steve Pelikan [EMAIL PROTECTED] To: users@httpd.apache.org Sent: Saturday, February 10, 2007 8:23 PM Subject: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2 We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. system(ls); returns an error with version 2.2 but runs w/o error with 2.0 Same with File::Copy copy() function. I believe I've made the configurations (httpd.conf) for the two apaches the same. What am I'm missing? Thanks Steve P - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Perhaps I wasn't clear. ANY script with a 'system()' command fails to run as a gci script under apache 2.2. Even if the command that is being run is in the same directory as the script (/var/www/cgi-bin) and has 777 permissions. And the same script does run under apache 2.0. For both apaches the user and group settings are the same. Thanks! Steve P Steve Swift wrote: My only experience with apache under linux is with redhat, so there may be subtle differences. In order to execute ls then the userid:group under which apache runs needs at least two things: 1. Execute access to the executable (typically /bin/ls) 2. To have the path to the executable (/bin in this case) in the PATH environment variable. There may be additional restrictions on accessing/executing the /bin/ls command. Can you logon as the user/group and execute the ls command? This is inconclusive if it works as the environment may be different. It would probably be a better test if you could issue the ls command from a cron task running on behalf of the userid:group that you use in apache. Additionally, are you using suexec? I'm suspect there are other restrictions if you do, maybe. On 10/02/07, *Steve Pelikan* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. system(ls); returns an error with version 2.2 but runs w/o error with 2.0 Same with File::Copy copy() function. I believe I've made the configurations (httpd.conf) for the two apaches the same. What am I'm missing? Thanks Steve P - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.35/680 - Release Date: 2/10/2007 9:15 PM - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. What am I'm missing? httpd -l to compare which MPM's you built with? Are you running mod_cgi or mod_cgid? Did you build with suexec? - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Being in the same directory as the program that is running is no guarantee that the command will be found, unless you either have . in the PATH, or the language your command is written is explicitly looks in the same directory as the running program when resolving commands. On 11/02/07, William A. Rowe, Jr. [EMAIL PROTECTED] wrote: Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. What am I'm missing? httpd -l to compare which MPM's you built with? Are you running mod_cgi or mod_cgid? Did you build with suexec? - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Thanks. It is finding and executing the scripts. (Can put in a print statement before the system() command and see the results on a web browser calling the script. Both the 2.0 and 2.2 apaches are using mod_cgi. In 2.0 it is built in and in 2.2 there's a LoadModule statement for it in httpd.conf. But: mod_suexec is loaded in 2.2 and not loaded or built in in 2.0. This is a difference I hadn't thought about or even known about. I don't really know about suexec or how it should be configured, but it looks like it could be close to my problems. Thanks for the pointer. Steve P Steve Swift wrote: Being in the same directory as the program that is running is no guarantee that the command will be found, unless you either have . in the PATH, or the language your command is written is explicitly looks in the same directory as the running program when resolving commands. On 11/02/07, *William A. Rowe, Jr.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. What am I'm missing? httpd -l to compare which MPM's you built with? Are you running mod_cgi or mod_cgid? Did you build with suexec? - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.35/680 - Release Date: 2/10/2007 9:15 PM - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Just having suexec loaded shouldn't make any difference because (AFAIK) it isn't actually used unless you explicitly request its use. Putting a print statement before the call to system(ls) doesn't tell us anything about whether or not the running program can *find* the ls command in order to execute it, it only proves that you are about to try (and probably fail, perhaps for one of the reasons I've mentioned). It may well be that the error you are geting is command ls not found. On 11/02/07, Steve Pelikan [EMAIL PROTECTED] wrote: Thanks. It is finding and executing the scripts. (Can put in a print statement before the system() command and see the results on a web browser calling the script. Both the 2.0 and 2.2 apaches are using mod_cgi. In 2.0 it is built in and in 2.2 there's a LoadModule statement for it in httpd.conf. But: mod_suexec is loaded in 2.2 and not loaded or built in in 2.0. This is a difference I hadn't thought about or even known about. I don't really know about suexec or how it should be configured, but it looks like it could be close to my problems. Thanks for the pointer. Steve P Steve Swift wrote: Being in the same directory as the program that is running is no guarantee that the command will be found, unless you either have . in the PATH, or the language your command is written is explicitly looks in the same directory as the running program when resolving commands. On 11/02/07, *William A. Rowe, Jr.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. What am I'm missing? httpd -l to compare which MPM's you built with? Are you running mod_cgi or mod_cgid? Did you build with suexec? - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.35/680 - Release Date: 2/10/2007 9:15 PM - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
Just having suexec loaded shouldn't make any difference because(AFAIK) it isn't actually used unless you explicitly request its use. Good point. Okay, in a perl cgi script run by version 2.2 the command system(ls) returns an error code (256, as I recall which corresponds to actual exitcode 1) which I can print after the system(ls) call. Using apache 2.0 the perl statement system(ls) returns 0 as it should. Using a nonsense command system(foo); produces an error code of -1 with both 2.0 and 2.2 An additional bit of info that suggests there's a path/permissions problem is that perl cgi scripts run with the apache 2.2 report an error with a require(/home/pelikan/test.txt); (can't find file) but can do require(/var/www/cgi-bin/test.txt); As if whoever's running the script can see cgi-bin but not /home/pelikan (though the /home/pelikan is set to let anyone read and execute) The file test.txt exists in both places. Apache runs as user 'apache' and there's no login allowed for that user so I don't know how to run a program or view the path for user apache. I'll read up on how to do cron and see if I turn that into a test. THanks! Steve P Steve Swift wrote: Putting a print statement before the call to system(ls) doesn't tell us anything about whether or not the running program can *find* the ls command in order to execute it, it only proves that you are about to try (and probably fail, perhaps for one of the reasons I've mentioned). It may well be that the error you are geting is command ls not found. On 11/02/07, *Steve Pelikan* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Thanks. It is finding and executing the scripts. (Can put in a print statement before the system() command and see the results on a web browser calling the script. Both the 2.0 and 2.2 apaches are using mod_cgi. In 2.0 it is built in and in 2.2 there's a LoadModule statement for it in httpd.conf. But: mod_suexec is loaded in 2.2 and not loaded or built in in 2.0. This is a difference I hadn't thought about or even known about. I don't really know about suexec or how it should be configured, but it looks like it could be close to my problems. Thanks for the pointer. Steve P Steve Swift wrote: Being in the same directory as the program that is running is no guarantee that the command will be found, unless you either have . in the PATH, or the language your command is written is explicitly looks in the same directory as the running program when resolving commands. On 11/02/07, *William A. Rowe, Jr.* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. What am I'm missing? httpd -l to compare which MPM's you built with? Are you running mod_cgi or mod_cgid? Did you build with suexec? - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.441 / Virus Database: 268.17.35/680 - Release Date: 2/10/2007 9:15 PM - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] -- Steve Swift http://www.swiftys.org.uk No
Re: [EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
On 10 feb 2007, at 19.23, Steve Pelikan wrote: We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. system(ls); returns an error with version 2.2 but runs w/o error with 2.0 Same with File::Copy copy() function. I believe I've made the configurations (httpd.conf) for the two apaches the same. What am I'm missing? Thanks Steve P Try running system with the full path of the executable, and for commands in the same directory as your script with ./ scriptname The dot in the path name explicitly specifies a file in the current directory. -- What is a woman that you forsake her, and the hearth fire and the home acre, to go with the old grey Widow Maker. --Kipling, harp song of the Dane women Tommy Nordgren [EMAIL PROTECTED] - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
[EMAIL PROTECTED] CGI differences in apache 2.0 and 2.2
We have several perl cgi scripts that run fine with apache 2.0 but fail with 2.2. This is using 2.2 that is part of recent Fedora and 2.0.59 that I just built and installed on the same machine. The problem seems to be with system() calls in perl. system(ls); returns an error with version 2.2 but runs w/o error with 2.0 Same with File::Copy copy() function. I believe I've made the configurations (httpd.conf) for the two apaches the same. What am I'm missing? Thanks Steve P - The official User-To-User support forum of the Apache HTTP Server Project. See URL:http://httpd.apache.org/userslist.html for more info. To unsubscribe, e-mail: [EMAIL PROTECTED] from the digest: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]