Custom PHP5 Install

After spending the better part of 2 days trying to get a custom installation of PHP5 working I am admitting defeat.

Working from the script found at I was able to successfully get PHP5 to compile. However I did have to disable SSL in order to get it to work as per

After compiling I added this to the sites .htaccess file.

Options +ExecCGI
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

<FilesMatch “^php5?.(ini|cgi)$”>
Order Deny,Allow
Deny from All
Allow from env=REDIRECT_STATUS

Upon doing this all php scripts are greeted with the following error.

Internal Server Error: Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

After trying to re-install and make config changes I just wind up being more confused. Also I noted that in the script being used the PHP options are configured with --with-config-file-path=${BASEDIR}/ but at the end of installing, the script says there is an editable php.ini in the cgi-bin. Should the php.ini be in the cgi-bin? Also does the php.ini need to be modded after install to point to the correct directories or does the install script do that already?

Any help at this point would be wonderful.


This just happened to another user (see this thread)

Check the permission on the directory, or log in to your shell account, go to the web home dir and:chmod 755 cgi-bin…then descend to the cgi-bin directory and:chmod 644 php.ini chmod 755 php.cgiThis will either fix your problem or at least serve to rule out permissions as a part of the fuss.

Thanks for your help, I ran the chmod commands and I’m still getting the Internal Server Error 500. I guess this rules out permissions then.


Let’s hope (…but likely a safe bet).

I’d try deleting that whole “…” stanza in the .htaccess file next.

And just to be on the safe-ish side, try changing the second two lines to something like:AddHandler phpFive .php Action phpFive /cgi-bin/php.cgi…as opposed to using a handler name with a dash in it; I’m not sure whether or not Apache plays nicely with that sort of thing.

If after those two changes you’re still getting a 500 then (to put it bluntly) you need someone smarter than me.

(…which shouldna be too terribly hard to find).

Another piece that goes wrong with a custom compile is the missing page handling (404 error). In my .htaccess I use the following:# Fix PHP CGI missing input file ------------------------------ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule (.*) /_err/404.php [L] …to fix any fuss with missing pages (obviously you’ll need to change the filespec in the last line to whatever you wanna use for a 404 error page).

Sounded promising but alas Internal Server Error 500 remains.

Thanks for your input though.

After compiling does the php.ini in the cgi-bin need any kind of modification specifying where it’s located?

Well, the “cgi-bin” directory containing the php.cgi and php.ini has to be in your website’s home directory, which the compilation script should have done (but hey, ya never know). If it didn’t, you’ll want to find where the compilation script left it and copy it to the appropriate web directory and check the permissions again.

Just a note: The location of “php.cgi” and the “php.ini” file used by php.cgi (using “-c” option) can be tweaked with a shell wrapper script; see

Silly question perhaps, but if you remove the .htaccess file altogether do you still get a 500? If so, that’s almost certainly a matter for the DH support peoples.

And since I’m fresh out of ideas, if you aint got a support ticket open already, I’d get one going.

With no .htaccess it just uses the DH install without issue.

Tenstones Gaming Community