Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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
</Directory>

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

 
discard

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.