[mapserver-users] Can't get PHP to work as a CGI.

Ben Logan ben at wblogan.net
Thu Jul 4 06:10:57 EDT 2002


On Wed, Jul 03, 2002 at 11:32:25PM -0500, David L Norris wrote:
> How about something like this:
> 
>  <VirtualHost 192.168.1.40>
>         ServerName map.log.cabin
>         ServerAlias map
>         DocumentRoot /var/www/html/ben/mapserv_demo/local/
> 
>         ScriptAlias /cgi-bin/ /var/www/html/ben/mapserv_demo/local/cgi/
> 	AddType application/x-httpd-php-cgi .pmap
>         Action application/x-httpd-php-cgi /cgi-bin/php
> </VirtualHost>
> 
> I use a .htaccess file instead of twiddling with the virtual server
> config.  This way I can use the standard .php extension and switch from
> mod_php to the CGI where required.  I also generally keep my cgi-bin out
> of the web tree and map it with ScriptAlias.

Thanks, David.  The above did indeed work.
 
> > The permissions on the cgi directory are 750 and it's group is apache.
> > When I point my browser to http://map/test.pmap (filesystem url:
> > /var/www/html/ben/mapserv_demo/local/test.pmap), I get a 404 stating
> > that /cgi/php/test.pmap couldn't be found.  It appears to me that
> > Apache isn't rewriting the URL or something similar, however I'm not
> > very familiar with Apache configuration.
> 
> Do you get a 404 when you request /cgi/php?  If so then make sure php
> was installed to your cgi directory.  Probably either a config problem
> or a file/directory name problem.

I didn't get a 404, but the binary didn't get executed.  Instead,
apache would just serve up the binary as-is...it was pretty ugly.  I
created a simple python cgi script in the cgi directory, and it
wouldn't execute it either, so apparently what I had in my httpd.conf
just wasn't telling it to use cgi as a cgi bin.  It works with
your config.

Now I can compile Mapserver 3.6.1.  The whole reason I'm upgrading
from 3.5, is that a call to processquerytemplate in 3.5 always gives
an undefined function error.

Thanks for your help,
Ben

-- 
Ben Logan: ben at wblogan dot net
OpenPGP Key KeyID: A1ADD1F0



More information about the mapserver-users mailing list