Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

migrated from Jun 21 '11 at 9:01

This question came from our site for professional and enthusiast programmers.

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 '11 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 '11 at 10:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.