Custom PHP 5.3 install... cgi-bin outside of webroot?


#1

So I just did a custom PHP 5.3.3 install with the instructions on this page (only I used 5.3.3 instead of 5.3.1). I used the script for “Improved script for a minimal PHP 5.3.x install with APC”.

Everything seems to be working fine, and everything in my website root is being parsed by 5.3.3. However, I need to change my web root to a subdirectory.

Current layout:

/ mydomain.com/ <-- web root cgi-bin/ .htaccess <-- tells the server to use the cgi-bin/php.cgi index.php

Desired layout:

/ mydomain.com/ cgi-bin/ projectName/ webroot/ <-- web root .htaccess index.php

The contents of my .htaccess file are:

[quote]Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

#Deny access to the PHP CGI executable and config files
<FilesMatch “^php5?.(cgi|ini)$”>
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS
[/quote]

Now obviously I’d need to somehow modify this to point to the cgi-bin, which would now be outside of the web root. However, the path to php.cgi is relative to the web root (why?). How would I go about configuring my .htaccess file to allow this setup?

Thanks in advance.


#2

If you don’t mind waiting a week or so, official PHP 5.3 support should be showing up very soon. It doesn’t include APC by default, but there’s an easy way to add extensions which I’ll explain once the feature is fully rolled out.


#3

Any progress on this? How do you add extensions the “easy” way, already running a custom php install but was wondering if there is a more “supported” way of doing this by Dreamhost.


#4

OK, here you go. Please keep in mind that PHP 5.3 is still in BETA so this process may change before PHP 5.3 is finalized.

If you want to completely override the system php.ini, create your own at $HOME/.php/5.3/php.ini. Don’t do this unless you absolutely have to, as there may be important changes made to the system php.ini.

If you just want to add some extensions or change settings, put the additional configuration in $HOME/.php/5.3/phprc.


#5

Ok i’ve tried it and works except that i can’t seem to get apc.so to load, here is what i did:
[list=1]
[]Changed extension_dir to point to a directory under my user and copied extensions from DH over inside the folder
[
]Downloaded apc and phphized, configured then ran make
[]Copied apc.so in the extension_dir
[
]Added [apc] configuration in the phprc file using the DH wiki settings.
[/list]
Any idea why it won’t load it? It does load other extensions just not APC.


#6

Are you sure that you built apc.so as an extension for PHP 5.3? PHP 5.2 extensions aren’t compatible with 5.3; you will need to use the build files from /usr/local/php53:

/usr/local/php53/bin/phpize
./configure --with-php-config=/usr/local/php53/bin/php-config
make

#7

Ok finally got it working, thanks for the help. As a side note if after following these instructions you still get a server 500 error check the path of apc.mmap_file_mask, that directory must exist.