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

David L Norris dave at webaugur.com
Thu Jul 4 00:32:25 EDT 2002


On Wed, 2002-07-03 at 17:11, Ben Logan wrote:
> but it isn't working
> for me--I always get a 404 error.

Well, it's probably something simple.  I setup PHP-Mapscript last
weekend with little trouble.  Although, I have little clue what I can do
with it.  ;-)

> I have defined a VirtualHost section in my httpd.conf file which looks
> like this:
> 
> <VirtualHost 192.168.1.40>
>         DocumentRoot /var/www/html/ben/mapserv_demo/local
>         <Directory /var/www/html/ben/mapserv_demo/local/cgi>
>                 Options ExecCGI FollowSymLinks
>         </Directory>
>         Action pmap-script /cgi/php
>         AddHandler pmap-script .pmap
>         ServerName map.log.cabin
>         ServerAlias map
> </VirtualHost>

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.

> 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.

-- 
 David Norris
  Dave's Web - http://www.webaugur.com/dave/
  Augury Net - http://augur.homeip.net/
  ICQ - 412039




More information about the mapserver-users mailing list