Custom php.ini

wordpress

#1

Hi folks,

Wondering if anyone can lend me some assistance in getting my custom php.ini file to work. I’ve followed the instructions in the wiki (http://wiki.dreamhost.com/php.ini) to the letter, but a test using php_info() indicates that my site is not using the custom php.ini file (it is still using /etc/php5/cgi/php.ini).

It seems to me that my .htaccess file is not making the site use the /cgi-bin/php-wrapper.cgi file, but I can’t figure out why.

There are numerous posts about custom php.ini files here in the forums, but none of the suggestions or fixes seem to be working for me.

The only way in which my steps differed from the wiki article was that I had to create my .htaccess file, while the wiki seemed to indicate that it should have already been there.

Anyway, here’s the contents of my .htaccess file, found in my site’s root folder:

Action php-cgi /cgi-bin/php-wrapper.cgi Action php5-cgi /cgi-bin/php-wrapper.cgiAnd here’s the contents of my php-wrapper.cgi file, found in the site’s cgi-bin folder:

#!/bin/sh exec /dh/cgi-system/php5.cgi $* EOFI’ve changed the permissions on both the cgi-bin folder and the .htaccess file to 755, and my cgi-bin/php.ini file to 640.

Can anyone see anything I’m missing?


#2

Problem solved!

In case it helps anyone else, this is what I did:

I removed the php.ini and php-wrapper.cgi file from the cgi-bin folder (giving me an empty cgi-bin folder).

I copied php.cgi and php.ini into my site’s cgi-bin folder:

cp /dh/cgi-system/php.cgi ~/[your website directory]/cgi-bin/php.cgi cp /etc/php/cgi/php.ini ~/[your website directory]/cgi-bin/php.iniI edited the .htaccess file (in the site’s root):

AddHandler php-cgi .php Action php-cgi /cgi-bin/php.cgiAfter that, I was all set!


#3

you know whats really weird i created a new php.ini successfully for one of my domains, but i can’t do it now for a new one, and i have no idea why…

i think its my .htaccess file theres gotta be something wrong with it… the file permissions or something, what are yours set at? (the htaccess in the root) and what does your htaccess file say

for my new one i just have a blank file that has
AddHandler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

which causes a internal server error when i try to view my phpinfo


#4

and,
if i follow this:

when I add those lines to my .htaccess file, it causes an internal server error, any suggestions anyone?

this is driving me insane

because somehow i managed to get it to work a month or two back when i did it for a different domain here i think i did what you did mike that solved your problem, ive tried that here too, but anytime i modifiy the .htaccess i get an internal server error, or, it just doesnt change.

this is driving me insane.

i thought i would have been lucky and try to copy the cgi-bin folder from the other domain and the htaccess file but that didnt work :S


#5

Hey,

Sorry, somehow missed your responses. My .htaccess file has the same contents as yours:

AddHandler php-cgi .php Action php-cgi /cgi-bin/php.cgiNothing else in it. My permissions are 755 on that file. I think DH recently changed (like a couple weeks ago) how they’re handling PHP because of their switch to PHP5 exclusively. I’m not sure if the wiki accurately reflects that change (I could be wrong, just a guess on my part).


#6

I too need help setting up a custom php.ini file.

I’ve installed wordpress, and I’m using it to host mp3’s of a local radio show. The first mp3 we have to post is about 50Mb.
The problem is when I try to upload the file it says that my upload_max_filesize on my php.ini is 7M

so I go http://wiki.dreamhost.com/PHP.ini and follow the instructions closely, yet the error still won’t let me upload.

Then I tried the instructions posted here in this thread, and still the limit persists.

I also find it a bit odd that neither the upload_max_filesize or max_post_size vaules that I change in the copied php.ini are 7M… which leads me to belive that I’m not changing the right values.

:S

Any help would be greatly appreciated

DC


#7

This worked to me.
Thanks man!

Hum… This install php 4? How to install php 5?


#8

Same problem here…

Did anyone work out how to load a php.ini AND php5?


#9

ok got it - use php5.cgi


#10

Here did not work.
I had to do many things that not even I know what I did to get php5. lol


#11

Heh guys I followed this thread and the custom php.ini wiki but still cannot get it to work. I am trying to apply it to a subdirectory maybe that is my problem…
The error I get is:
The requested URL /cgi-bin/php5.cgi/shop/install.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Any help would be greatly appreciated


#12

Something isn’t quite right with the setup. I’m using (per the wiki):

Action php-cgi /cgi-bin/php-wrapper.cgi
Action php5-cgi /cgi-bin/php-wrapper.cgi

And on my site it comes across as:

‘,’<".(time()-(cache_flush*3600))); if (!defined(‘cache_flush’)) mysql_query(“INSERT INTO $configtable VALUES(‘cache_flush’,”.time()."’)"); mysql_query(“UPDATE $cachetable SET c_value=’”.time()."’ WHERE c_key=‘cache_flush’"); } //close MySQL connection @mysql_close(); //output page generation time $end = time() + microtime(); $tot = round(($end - $strt)*1000); echo “”; ?>

If I take the statement out of the htaccess, then the site goes back to normal. What would be causing this??

Thanks for any insight… Cris


#13

Hey guys all good I sorted it out I must have just been staring at the screen for to long and missed a stupid mistake I needed to add the sub-directory in the .htaccess

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

:frowning:


#14

Hey treasuretwist I wouldn’t use the wiki instructions any more follow the instructions from mikecron from a previous post

"
I removed the php.ini and php-wrapper.cgi file from the cgi-bin folder (giving me an empty cgi-bin folder).

I copied php.cgi and php.ini into my site’s cgi-bin folder:

cp /dh/cgi-system/php.cgi ~/[your website directory]/cgi-bin/php.cgi
cp /etc/php/cgi/php.ini ~/[your website directory]/cgi-bin/php.ini

I edited the .htaccess file (in the site’s root):

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