Seperate PHP.ini file

Seperate PHP.ini file

Posted by: mwh
Posted on: 2009-07-22 11:48:00

I was having issues getting PEAR to work correctly, and I figured out that I think it was because I couldn't modify the php.ini file, so I tried to install a seperate one...

I followed the instructions on http://wiki.dreamhost.com/PHP.ini exactly!

I double checked everything, but it still isn't working. Our site no longer loads.

So I googled the issue and it seems like many people try this, most are successful, but others aren't. For the ones that aren't there doesn't appear to be a lot of solutions, so I am coming here.

Here is some stuff to help with the diagnosis...

Contents of .htaccess…

#--- DH-PHP handlers ---
Options +ExecCGI
SetEnv "PHPRC /home/username/sitename/cgi-bin"
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
#Action php5-cgi /cgi-bin/php-wrapper.fcgi (this is commented out in order to keep the site running but uncomment to test)
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/(home/members|failed_auth\.html).*$ [NC]
RewriteRule . - [L]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Contents of cgi-bin/php-wrapper.fcgi…

#!/bin/sh
PHPRC="/home/username/sitename/cgi-bin"
export PHPRC
exec /dh/cgi-system/php5.cgi $*

Contents for the cgi-bin directory…

$ dir -a -l
total 68
drwxr-xr-x 2 username pg1605836 4096 2009-07-22 10:45 .
drwxr-xr-x 14 username pg1605836 4096 2009-07-22 09:02 ..
-rw-r--r-- 1 username pg1605836 146 2009-07-22 09:02 _debug.txt
-rwx------ 1 username pg1605836 54 2009-07-22 09:02 dispatch.cgi
-rwx------ 1 username pg1605836 84 2009-07-22 09:02 dispatch.fcgi
-rwxr-xr-x 1 username pg1605836 106 2009-07-22 09:52 php-wrapper.fcgi
-rw-r----- 1 username pg1605836 45388 2009-07-22 09:02 php.ini
-rw-rw-r-- 1 username pg1605836 0 2009-07-22 10:45 php5-wrapper.fcgi


what happens if you uncomment that one line in .htaccess, this shows up when loading our site in the browser…

#!/bin/sh PHPRC="/home/username/sitename/cgi-bin" export PHPRC exec /dh/cgi-system/php5.cgi $*


It appears to be the exact contents of the php-wrapper.fcgi file. Since it can read the file, I have to assume there are no typos, the files are in the right place and they have the right permissions. Correct me if I am wrong.



I am almost there, there is just something missing, and I am sure it is simple!

Can someone help?

Re: Seperate PHP.ini file

Posted by: Atropos7
Posted on: 2009-07-22 12:22:00

In reply to:

I am almost there, there is just something missing, and I am sure it is simple!

Can someone help?


...and did you go to Domains -> Manage Domains and enable FastCGI ?





Customer since 2000 cool openvein.org

Re: Seperate PHP.ini file

Posted by: mwh
Posted on: 2009-07-22 12:31:00

No I didn't but I can try that.

The of all the wiki articles I could find on php5, I didn't find that instruction anywhere. If I am not running fastCGI (I don't think I am because I didn't set it), will this setting effect anything?

Thanks for the reply!

Re: Seperate PHP.ini file

Posted by: mwh
Posted on: 2009-07-22 12:44:00

OK, I think I got it to work, and it was stupid simple...

the wiki (http://wiki.dreamhost.com/PHP.ini) is very clear to have the extension be .fcgi

But I just changed the extension to .cgi and guess what, everything works.

Can someone make a note on that wiki so that someone else doesn't make the same mistake i did.

Thanks for the help!

Tags: dhpearcgi binwiki