Problem with custom php.ini file?


I followed the instructions to get a custom php file to enable larger uploads, however when I add the lines to my .htaccess file, I get the error "Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request." when I try to go on my website. Anyone know why?



What editor did you use to add the lines to your .htaccess? It could be improper line feeds inserted by your text editor.

What does your .htaccess file look like now?



I tried it with both webftp & the nano editor in PUTTY.

The file currently looks like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php?title=$1 [L,QSA]
Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
Action php5-cgi /cgi-bin/php-wrapper.fcgi



The .fcgi requires that Fast CGI is enabled on your domain. It’s a dropdown menu in your Fully Hosted Domains settings. Do you have this turned on for your domain?



Yep, PHP 5 FastCGI is selected!


Is your cgi-bin and the files within readable to everybody? What files do you have in your /cgi-bin directory?



Yes all readable, in cgi-bin I have php-wrapper.fcgi & php.ini

Thanks for all the help so far!


To double check, what happens if you comment out the first, and/or second Action line? With both commented out, I expect the site to work. If not, comment out all four of your new lines. It could be that there’s something with the php.ini file. Can you log into shell and do a diff:
diff /etc/php5/cgi/php.ini /home/USER/

and post the output? It should only be a few lines.



Yep, commented out it works.

The output is:
< post_max_size = 8M

[quote]post_max_size = 20M

< upload_max_filesize = 7M

[quote]upload_max_filesize = 20M




Is your site broken for all URLs? How about a plain .html file?

How about trying a test.php file with just the following lines:

<?php echo phpinfo(); echo "\n"; I'm running out of ideas, otherwise. Maybe someone else will see something obvious. Any hints in your access.log or error.log file in your home directory's /logs/ area? -Scott


In my error.log file there are a fair few entries saying:
Premature end of script headers: php-wrapper.fcgi


See link below.

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


Oooh, that looks useful, I’ll give that a go tomorrow. Should I delete the files I have made already?


Not necessary, but it’s always wise to install things in a clean environment :wink:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost


Awesome, now working! Thanks!


What’s different between the sXi method and the wiki? If the wiki is incorrect, it should be changed.



I don’t think there’s any major programmatic difference that makes the autoinstallers work, they probably just avoid the common cr/lf, dos2unix, typos, etc. (read: user error). You’d remember when rlparker PM’ed a few of us asking why we thought people were having problems with the Wiki articles. The basic INI installation appeared clear & correct back then so I assumed user error and knocked up a php.ini and ioncube installer so we didn’t have to rehash “How to install X” daily at the forum.

Lemme just go see what’s there now…

If followed correctly the Wiki should get things rolling in regard to accessing a php.ini or installing ioncube, but the plethora of “installing custom PHP” scripts need editing to compile PHP correctly across all builds/servers. It could be done with one script yet last time I looked (8 months ago?) there were 5, and I just saw about 4 on one page just now (some of which are incredibly flawed in their build order) so can only assume there are now extra multiple copy/pasta goodies to further confuse the casual user and send them into fits of rage. Much of the info appears to be the blind leading the blind so users shouldn’t look at it as a copy/pasta saviour, but rather as a rough guide on ways to get things done. They should absolutely not use some of those shell scripts.

ps. I facepalm when I read the Wiki so I don’t look at it anymore :slight_smile:

Maximum Cash Discount on any plan with MAXCASH

How To Install PHP.INI / ionCube on DreamHost