I have a basic php cgi configuration problem on top of the apache web server in Ubuntu 10.04 . I am trying to setup cgi so as to answer one of the urls localhost/cgi-bin/index.php or localhost/index.php with the output from the execution of /usr/lib/cgi-bin/index.php which currently has as output phpinfo() .

I followed Ubuntu 10.04 > Ubuntu Server Guide > Web Servers > HTTPD - Apache2 Web Server to get me started and have the virtual host stuff done . I also created the php script and tried to access it but I have the force redirect problem . I tried to fix it by enabling mod_actions and doing what the page says about the Action and AddHandler directives. I inserted the 2 directives in httpd.conf but I get accesses to /var/www in the error log:

Action php-script /cgi-bin/php # (or /cgi-bin , /cgi-bin/ for my setup)
AddHandler php-script .php

So now I am stuck and I could use some help.

  • Are you trying to run PHP scripts using CGI methods? It'd be far more efficient to use the in-server PHP module instead. CGI scripts were all the rage years ago, but only because language interpreters were NOT embedded inside the webserver. It's definitely a slower method than in-server processing.
    – Marc B
    Jun 20, 2011 at 21:46
  • I thinck I'll settle for a way to do what I want to do : get 'localhost/index.php' to be answered by '/usr/lib/cgi-bin/index.php' at first and go on from there , since I have a school project to do that won't be deployed in production that I need done , and I also have a mapserver cgi that I have to figure out how to use later so cgi is the way to go I guess .
    – branco
    Jun 21, 2011 at 10:04


You must log in to answer this question.

Browse other questions tagged .