我可以编译自己的PHP,同时保持与Ubuntu提供的一个?

我想同时保留随Ubuntu提供的最新PHP,并在某处安装特定的PHP版本。 它可行吗? 我可以在某些文件夹中编译PHP,然后在Apacheconfiguration文件(我的意思是随Ubuntu提供的Apache)在需要的时候在PHP目录之间切换。

是的你可以。 Fisrt编译和安装新的PHP,然后定义你的新的PHP作为一个CGI模块到Apache。 打开apacheconfiguration文件并添加这行

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

或者你可以在系统范围内定义新的扩展

 AddHandler my-php-script .myphp Action my-php-script /path/to/your/php_executable