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'm trying to install a second version of PHP, to run alongside the current version of php. I've compiled the latest php source from github (5.5-DEV), and I'm trying to run it as CGI.

Here is my virtual host config:

<VirtualHost *:8055>
    DocumentRoot /Library/WebServer/Documents/
    ScriptAlias /cgi-bin/ /usr/local/php55/cgi

    Action php55-cgi /cgi-bin/php-cgi
    AddHandler php55-cgi .php

    <Directory /Library/WebServer/Documents/>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>

    DirectoryIndex index.html index.php
</VirtualHost>

But when I go to http://127.0.0.1:8055/info.php, I get the following error:

Forbidden

You don't have permission to access /cgi-bin/php-cgi/info.php on this server

Edit

I'm now switching between

LoadModule php5_module        /usr/local/php54/libphp5.so

and

LoadModule php5_module        /usr/local/php55/libphp5.so

It works for now, but is not ideal. I would like to have the different versions of php on different virtual hosts

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You'll need to tell Apache how to handle the system's new /usr/local/php55 directory.

<Directory /usr/local/php55/cgi>
    Allow from all
</Directory>

You might need to add an extra "/" at the end ScriptAlias assignment, or the Action may resolve to

Action php55-cgi /usr/local/php55/cgiphp-cgi

So your vhost block would read as:

<VirtualHost *:8055>
    DocumentRoot /Library/WebServer/Documents/
    ScriptAlias /cgi-bin/ /usr/local/php55/cgi/

    Action php55-cgi /cgi-bin/php-cgi
    AddHandler php55-cgi .php

    <Directory /usr/local/php55/cgi>
        Allow from all
    </Directory>

    <Directory /Library/WebServer/Documents/>
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>

    DirectoryIndex index.html index.php
</VirtualHost>
share|improve this answer
    
Awesome, thank you very much, it worked! –  Pierre Oct 29 '12 at 7:45

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.