Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 want to both keep the latest PHP provided with Ubuntu and to have a specific PHP version installed somewhere. Is it doable? Can I just compile the PHP in some folder and then somewhere in Apache configs (I mean the apache provided with Ubuntu) switch between PHP dirs when needed.

share|improve this question
up vote 4 down vote accepted

Yes, you can. Fisrt compile & install new php, and then define your new php as a cgi module to apache. open apache config file and add this lines

<Directory /your/desired/directory/>
        AddHandler my-php-script .php
        Action my-php-script /path/to/your/php_executable

or you may system wide define new extension

AddHandler my-php-script .myphp
Action my-php-script /path/to/your/php_executable
share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.