Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script name in perl cgi script 1

Status
Not open for further replies.

jursetti

Programmer
Jun 20, 2002
7
US
I have several AIX 5.3 web servers. Some are running Apache 2.0.59 and others are running IBM HTTP Server 6.0.2, which equates to Apache 2.0.47. My perl 5.8.8 cgi scripts return just the script name with no path information from the perl $0 variable on the IBM HTTP 6.02/Apache 2.0.47 servers. But I'm getting the full path to the script when I running on the Apache 2.0.59 server.

If I run the script outside of the web server on any of the servers, I get just the script name with no path information.

For example, if my cgi url is and my document root is /www, $0 returns my_script.cgi on the IBM HTTP 6.0.2/Apache2.0.47 server and / on the Apache 2.0.59 server.

If I run my_script.cgi from the command line, $0 always returns my_script.cgi.

I will be switching all of my servers over to Apache 2.0.59 in the near future.

Could this be an apache configuration issue or is something else going on here? BTW, I also posted this on the apache forum.
 
Feherke,

I'm not using mod_perl on any of the servers, if that's what you're referring to.

There are a lot more modules loaded on my 2.0.59 servers, though.

Here are the modules loaded in httpd.conf on my 2.0.59 servers:

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule auth_anon_module modules/mod_auth_anon.so
LoadModule auth_dbm_module modules/mod_auth_dbm.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule asis_module modules/mod_asis.so
LoadModule info_module modules/mod_info.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule dir_module modules/mod_dir.so
LoadModule imap_module modules/mod_imap.so
LoadModule actions_module modules/mod_actions.so
LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

Here are the modules loaded on my other servers:

LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgid_module modules/mod_cgid.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so

Frankly, I know very little about any of these modules so I don't know which might impact my perl CGI script. There are probably a lot more loaded than I really need.

Jerry
 
Hi

Yes, that was I thinking to, mod_perl on Apache and noideawhat on IBM.

Other difference may be that one of the server changes the directory before running the CGI scripts and the other not. Next thing I would check is the current directory seen by the scripts. However I do not expect such behavior to be configurable.

Feherke.
 
I was thinking the same thing about how one web server must be using the full path and the other cds and executes from the soruce directory.

I'm changing my cgi scripts to use the SCRIPT_NAME server variable. That seems to be more consitent and reliable.

Thanks.

Jerry
 
Another option is to use the File::Basename module to strip off any extraneous path information that exists.
 
Good point. I've used that module. But, for these cgi scripts I think I'm going to stick with the SCRIPT_PATH server variable for now.

Thanks.

Jerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top