Portal Home > Knowledgebase > Articles Database > PHP4 & PHP5 not working correctly

PHP4 & PHP5 not working correctly

Posted by jthornton, 06-07-2008, 01:50 AM
Hello, I have suPHP installed in FastCGI mode. PHP5 is my default installation but I have it setup so that PHP4 can also run. At least that is my intention. I have PHP5 working without a problem. PHP4 is loading if I add the directinf x-httpd-php4 .php into my .htaccess file. HOWEVER: PHP (via phpinfo) is trying to load the config file from /usr/local/etc/php5/cgi/php.ini when it should be from ....php4/cgi/php.ini Where do I go to fix this? Or is there a second directive that I need to load in the .htaccess file? Also... In either php5 or php4, if I put a php.ini file into a directory, it is suppose to load that one. However, it is not doing this either. Please help.

Posted by rdogg, 06-07-2008, 10:17 AM
when compiling php you are able to specify wich directory to search for config files --with-config-file-path=PATH Sets the path in which to look for php.ini, defaults to PREFIX/lib.

Posted by jthornton, 06-07-2008, 10:32 AM
I am running DirectAdmin so I did it through their custombuild. Can anyone give me some direction on how to set this up?

Posted by Hosting_Reserve, 06-07-2008, 09:52 PM
Check the custombuild instructions in the DirectAdmin forums. Its all there. I did the same thing a few weeks ago. Alan

Posted by jthornton, 06-07-2008, 11:30 PM
Ok.. I'm a little lost here: - info.php: this loads PHP5 ** which is what I want - info.php4: this loads PHP4 - info.php5: this loads PHP5 - It also works using AddHandler and AddType in .htaccess file This is all fine. However, I have noticed regardless of which version loads the line that say "configuration file (php.ini) path" is showing /usr/local/php5/cgi/php.ini If the extension is .php (or .php5), then it will have another line there that says "Loaded Configuration File" and then it points to the same file. With extension of .php4 it doesn't show up. If I place a php.ini file in the current directory, it is suppose to load that php.ini file instead of the default on the server. Can someone please tell me how to get the local php.ini file to load instead?

Posted by smtalk, 06-15-2008, 04:29 AM
Just comment out suPHP_ConfigPath line in /usr/local/suphp/etc/suphp.conf.

Posted by jthornton, 06-16-2008, 09:51 PM
But I want suPHP installed. I want to make sure that all scripts run with the user privileges. I can't seem to find the tutorial for custombuild to setup php4 and php5 again. Maybe that will work?

Posted by jthornton, 06-16-2008, 11:15 PM
I just ran # ./build used_configs and this is what I got: I don't understand why it is saying this. My php.ini files are suppose to be loaded from /usr/local/php#/cgi/php.ini. Does anyone know what this isn't working??

Posted by jthornton, 06-16-2008, 11:50 PM
Thank you SmTalk. I didn't know what you meant, but I was able to find an article in the DA Knowledge base and I figured it out. I know have it working perfectly and loading the local php.ini file. I do have one more question: I saw something in the same article which said that I can actually put the php.ini file in the user home directory (ie. /home/username/domains/domainname). However, it didn't work for me. Is there a way that I can set it up so that I can put a config file in this location so it isn't available via the browser?

Posted by smtalk, 06-17-2008, 03:27 AM

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
need new router (Views: 381)


Customer Testimonials

John Doe
It's a great service with fantastic support. It's definately good value for your money. Overall rating, 10 out of 10.
Mike Smith
Much better than my previous hosting company - I also got help with migration at no extra cost. Friendly support too.
Copyright © 2015 DC International LLC in partnership with Bragin IT Solutions Inc. - All Rights Reserved.