Custom compile of PHP5

I have run through the instructions in the wiki to compile PHP5 so that I may change the ini file myself.

However Im just wondering how I actually use this version rather than the default version? I have checked my ini file and have it set how I want, but when I do phpinfo it still shows details of the default installation.

Any help for a n00b is appreciated :wink:

The wiki article does contain instructions for modifying your .htaccess file, this will make sure that your custom PHP5 install is used by your domain.

Something like the following must be added to your .htaccess file;

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

Assuming your custom PHP executable is located within the /cgi-bin/ sub-directory.

Also, if your only aim in compiling a custom PHP5 executable was to be able to modify the php.ini file, there is a somewhat easier method. Simply copy the existing php executable and php.ini from the default DreamHost install to a local directory and (once again) configure .htaccess to use it. More info in the wiki article linked below;


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )

wow that would’ve been easier!

anyway, might as well continue on from where I am.

Next q, how can I find the executable? It looks as though my ftp client hides some file extensions?

In my root I have a php5 dir. Under that I have; bin, etc, include, lib, man and share. Under bin dir I have a file called ‘php’.

Assuming that’s it, I changed htaccess to show:

Action phpFive /php5/bin/php.cgi

then had a look at phpinfo but it was still showing the default install?

thanks so much for your quick reply btw

I’ve never seen an FTP client hide specific file extensions, but I have seen many clients not show ‘hidden’ files by default, such as .htaccess. There should be an option somewhere in your FTP client configuration to enable the display of ‘hidden’ files.

Are you sure you followed these wiki instructions precisely?

The last few lines in the shell script in the wiki article are;

#copy PHP CGI
mkdir -p ${HOME}/${DOMAIN}/cgi-bin
chmod 0755 ${HOME}/${DOMAIN}/cgi-bin
cp ${INSTALLDIR}/bin/php ${HOME}/${DOMAIN}/cgi-bin/php.cgi
echo ---------- INSTALL COMPLETE! ----------

This should have created a cgi-bin sub-directory within your domain directory, set the required permissions and copied the php executable from where it was compiled to this sub-directory. Check your domain directory to see if this sub-directory (and the executable) exist.

If they do, then you simple need to add the following to your .htaccess file and the new install will be used.

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


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )

got it all, cheers

i was just being stupid and looking at a level in the dir structure too high. Sorted it all, and yeah my ftp client now shows hidden files…not that that makes a difference but comes in handy now it’s fixed.

Thanks so much for your help

Excellent, glad to hear that you have it sorted.

These things can be a little tedious to get right the first time, but next time you’ll have no trouble :slight_smile:

No problem, I am always glad to help out where I can.

Good luck.


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )