this is apache 2.2.4 on winxp pro, php, perl, mysql, its a development environment so far i have a default install and it created c:/apache2/cgi-bin and my .conf has DocumentRoot "C:/apache2/htdocs" and ScriptAlias /cgi-bin/ "C:/apache2/cgi-bin/" i currently have 5 domains via virtual host. the problem is i can't directly access scripts in the cgi-bin, not in the browser or if some script running in one of the domains uses the windows path. if i have a script that is common to, or invoked from multiple domains, how do i configure access to a common cgi-bin directory? i suppose i could create a cgi-bin in some domain tree and invoke common scripts from there, but insn't that defeating the purpose of a common cgi-bin directory?
do you have the cgi-bin module installed for Apache? (should be called mod_cgi or something like that)
if this is double reply, i apologize, the quick reply didn't show any thing posted looks like it, i have this directive activated LoadModule cgi_module modules/mod_cgi.so i basically followed this setup http://httpd.apache.org/docs/1.3/howto/cgi.html i just noticed the ScriptAlias /cgi-bin/ "C:/apache2/cgi-bin/" is inside a <IfModule alias_module> section, if that makes a difference i also have the addhandler directive for perl AddHandler cgi-script .cgi .pl
Hmmm, Ive only got experience setting up Apache in it's natural environment (Linux). Ok, so does the modules/mod_cgi.so file exist? I thought a Windows machine would be wanting a .dll file or similar. If the PHP setup works, what module does it need? mod_php.dll? In any case, this is a setup I use on one of my dev boxes: LoadModule cgi_module /usr/lib/apache2/modules/mod_cgi.so ScriptAlias /cgi-bin/ /var/www/cgi/ <Directory /var/www/cgi> Options Indexes FollowSymLinks MultiViews +ExecCGI AddHandler cgi-script .pl AddType application/x-httpd-php .php .phtml .php3 AddType application/x-httpd-php-source .phps AllowOverride None Order allow,deny allow from all </Directory> Code (markup): The most important things here are the LoadModule line, the AddHandler lineand the +ExecCGI option in the Options line
i do have a mod_cgi.so module in the modules directory the php runs a .dll, php5apache2_2.dll, that comes with php, i believe it has better performance than the .so i do have other .so loadmodule directives that are working, so i think that is ok and working my .conf didn't have specific directory section for cgi-bin, instead a 'generic' <Directory /> Options FollowSymLinks +ExecCGI -Indexes AllowOverride None Order deny,allow allow from all Satisfy all </Directory> i always had the addhandler and scriptalias directives but they were not in any directory section so i changed it based on your setup, to name the cgi-bin explicitly, <Directory "C:/apache2/cgi-bin"> and put in the addhandler, etc but still no luck, perhaps i'm not setting path to the cgi-bin correctly a php script invokes the .pl script here in question, if that is coded as, 'c:/apache2/cgi-bin/ubr_upload.pl', it doesn't run, in firefox i get 'firefox doesn't know how to open this address, because the protocol(c) isn't associated with any program', that message supposedly indicates path problems when i place the script in a virtual host documentRoot (or below) and code the path 'http://mydomain.com/ubr_upload.pl' (script in the documentRoot), it runs
That means the cgi-gateway is actually working You only really need to configure the .conf file appropriately. Attach it to this thread in a post and I'll have a look at it. could you paste the sample code that calls that perl script? you can't have php run the perl script, you need to have perl to run perl scripts Also, if you put 'c:/apache2/cgi-bin/ubr_upload.pl' directly into the url bar in firefox, it will throw you an error, as it expects a proper url. it will see the 'c:' and assume that 'c' is the protocol to use (such as http or ftp), hence the error message regarding the protocol.
thanks for your generous offer, not sure if you actually want to see entire .conf, leary about posting that, if needed i suppose i can post it with the virtual host directives deleted so as not to expose my domain info. as far as i can tell this is all the directives i have relating to cgi-bin <Directory "C:/apache2/cgi-bin"> Options FollowSymLinks +ExecCGI -Indexes AddHandler cgi-script .cgi .pl AllowOverride None Order allow,deny allow from all Satisfy all # Options -Indexes </Directory> AddHandler cgi-script .cgi .pl LoadModule cgi_module modules/mod_cgi.so <IfModule alias_module> ScriptAlias /cgi-bin/ "C:/apache2/cgi-bin/" </IfModule> this application i'm trying to run 'the right way' is uber uploader. its above my current skill level so pls bear with me. it looks like a .php script (form) obtains file name data and invokes a .js script with this code to then invoke the .pl, see where i put --> //Submit the upload form function startUpload(upload_id, debug_upload){ --> document.uu_upload.action = path_to_upload_script + '?upload_id=' + upload_id; document.uu_upload.submit(); for(var i = 0; i < upload_range; i++){ document.uu_upload.elements['upfile_' + i].disabled = true; } if(document.getElementById('upload_div')){ document.getElementById('upload_div').style.display = "none"; } if(!debug_upload){ initializeProgressBar(upload_id); } } the 'path_to_upload_script' is a .ini type variable, i currently code an http based path that runs, if that path is set to a 'windows' path (c:/apache2/cgi-bin/script.pl) it does not run. as far as running cgi-bin kinda directly, it was reading and some posts indicated i could do that addressing the browser with http://localhost/cgi-bin/etc, so that is what i had tried, with no luck, my localhost gives me a virtual host domain page that is set up with a proxypass to run a plone website
The Apache conf stuff you posted looks OK. The .js file you refer to is a javascript file. All javascript is run by your browser after the page is fully loaded up (ie, it's the last thing done), and thus it can't access directories on the webserver, except those that can be accessed via a browser. That's why c:/apache2/cgi-bin/script.pl doesn't work, but a http:// path would. So far, we know that the cgi-gateway is working properly. Now let's look at your script. Can you supply more info, please? screenshots might be handy too
well yes i understand an 'http' path is needed, the question i don't seem to be able to answer or convey is how do you configure apache to have an http path available for a common cgi-bin. do you just pick one domain and put the cgi-bin there? i have done that and can get the application working that way, but do not think that is correct. because i think of the cgi-bin as akin to a shared loadlib or object lib (ibm speak) or dll type repository, that scripts running in any apache 'domain space' can access. to me it seems like there should some type of 'internal' apache only, domain/http access that is not tied to a registered or public domain. i thought the default apache install with the cgi-bin directory at the same level as htdocs, indicated it could be acccessible from a webspace that is in htdocs (single domain) or below, multiple domains whose roots lie under htdocs. see http://httpd.apache.org/docs/2.2/mod/mod_alias.html maybe i have misunderstood the concept, there is no common cgi-bin for an apache installation running multiple websites. each site/domain has its own cgi-bin and thats as far as it gets. then i suppose a cgi-bin can be acccessed with a windows style path as long its in the hierarchy below the site root. or you can just use a http style path. as far as code, you can see it all if you get uber upload, http://uber-uploader.sourceforge.net/, it has 1 javascript and 1 perl, the rest are php. the sequence that runs is that a php script invokes the javascript which in turn invokes the perl script. as far as the localhost, if you go to job1data.com, when i address the browser with localhost/cgi-bin/somescript.pl, i get a response from that domain with a 404.
By default, each VH is meant to have it's own cgi-bin, which is declared in the <VirtualHost> tags, eg: <VirtualHost *:80> [other stuff] ServerName www.example.com ScriptAlias /cgi-bin "/home/example-site/cgi-bin/" <Directory "/home/example-site/cgi-bin/"> AddHandler cgi-script .pl .cgi DirectoryIndex index.pl index.cgi AllowOverride None Options None Options +ExecCGI Options -Indexes Order allow,deny Allow from all </Directory> [other stuff] </VirtualHost> Code (markup): Note that I'm using Linux-style server paths here. I don't forsee any major problems with setting the server path for multiple VH cgi-bins to being the same thing*, but you might run into permission problems somewhere along the line. In the end though, it'd be best to try not have a "global" cgi-bin and rather have one for each VH. *then again, I've never tried it