Phprc doesn't work


#1

The instructions for setting up a phprc at http://wiki.dreamhost.com/PHP.ini#Replace_the_system_php.ini_entirely don’t work.

Here’s the deal: I SSH to hulk.dreamhost.com, logging in as the same user which a site runs under. I created ~/.php/5.3/phprc. The contents of this phprc file is asdad = adadao. It’s nonsense because I’m trying to induce an error; no error = the phprc is being ignored.

In the Dreamhost panel, I have PHP 5.3 FastCGI selected for PHP mode for this site. None of the other check boxes under Web Options are selected.

Just to make sure PHP 5.3 is really running, I also run top in my SSH session. I can see php53.cgi running while I request pages for that site.

I visit the site get no error. Hence, the phprc is being ignored. I’ve also tried a valid setting that’s different than the default php.ini, and the valid setting is also being ignored.

I’ve tried killall php53.cgi, but that has no effect.

I also checked directory permissions. .php and 5.3 have 775, and phprc has 664. The files are owned by the same account under which the web site runs.

What gives?


#2

This is an incorrect assumption — PHP actually just ignores configuration lines that it doesn’t recognize.


#3

[quote=“andrewf, post:2, topic:55805”]

This is an incorrect assumption — PHP actually just ignores configuration lines that it doesn’t recognize.
[/quote]Thanks. So this should be a better test: phprc now only has upload_max_filesize = 100M. Yet when I run phpinfo(), it says upload_max_filesize is still at the Dreamhost default of 7M.[hr]
Now this is weird… The phpinfo()'s output has a field named Additional .ini files parsed, and its value references my exact phprc file.

Now I’m really confused: it sees my file, yet it doesn’t want to honor what I’ve put in it?


#4

You may have to kill any php53.cgi processes you currently have running so that a new one will be launched (and reread the configuration file). PHP only reads its configuration files once when it first starts up.


#5

Thanks. I actually had done that and verified the kill through running top. I’m scratching my head at why I didn’t notice the configuration variables changing before, but it’s working now. Thanks for your help!