Php.ini -- how to reload with my own PHP5?

software development


Hi. I successfully compiled PHP5 on my shared DH account a few weeks ago, and it’s working great, but the changes I’ve made to my php.ini file aren’t showing up.

My phpinfo() says my ini file is at: /home/myusername/php/php.ini, which is where I told php to put it when I compiled. My php.ini file is there, and I’ve edited it, but the changes – most notably, activating the openbasedir restriction, do not show up in phpinfo()!

It seems like I need to get my PHP to reload the ini file. According to, since I am running PHP as CGI, this happens at “every invocation.” [] Does that mean every time PHP runs a script, it loads PHP.ini? Well, if so, it’s not happening for me. If that’s not what it means, how else do I “invoke” PHP so it will load these options?

Does anyone have ideas about this? I’ve spent quite a while RTFM’ing, and I’m not really getting anywhere. Thanks in advance.


If that’s the case, just login to your DreamHost control panel. Go to Domains/Manage. Select the “Edit” link for the “Web” service for the domain in question. And disable PHP as CGI, thus allowing PHP to run normally.


MacManX, thanks for the tip, but I’m not sure the control panel is going to affect how the DH server processes the copy of PHP5 that I compiled myself. Besides that, I want to run PHP as a CGI (I don’t think there’s a way to compile your own on a shared DH server and not run it as CGI), and the binary I’m using is specifically compiled to run as CGI. Tx again, though.


After much frustration, I solved this problem by putting my php.ini file in the (web-accessible) directory where the php.cgi file resides. There is another (probably better) solution, however. As jbyers points out in a related thread in the KnowledgeBase, during configuration of PHP, your “–with-config-file-path” should be set to a path without a filename for the location of php.ini. If you’ve already screwed this up (like I did), just create a directory at that path called php.ini and put the real php.ini inside it. Or, like I said, you can put your php.ini file inside the same (web-accessible) directory where you put your php.cgi binary, since PHP checks there for the file first.