Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm working on a Dreamhost VPS, so I don't know if that has anything to do with this:

The include_path entry in the php.ini file seems to be completely ignored. There are several php.ini files scattered around by default, but none of them seem to be used when determining the include_path value. Including the file that phpinfo() says it's reading from (and no other files are overriding it as far as I can tell).

I can completely remove the php.ini file, and the include path doesn't change. It's always equal to .:/usr/local/lib/php:/user/[username]/pear when I run a web request. It should be .:/usr/local/lib/php:/usr/local/php5/lib/pear.

/user isn't even a directory on the server. It's /home. And phpinfo() prints out a different include_path depending on whether I call it from the command line (where it works correctly) or via a web request (where it returns the above).

The really weird bit is that the include path as shown by phpinfo() sometimes randomly changes when I refresh to be the correct value, but refreshing again resets it to the old, wrong value.

So... What?

share|improve this question

migrated from stackoverflow.com Feb 6 '12 at 19:42

This question came from our site for professional and enthusiast programmers.

    
@EdMarty Do not cross post. We move questions to the appropriate site. Thank you and welcome to Server Fault. For more details about how the sites work check out the FAQ! –  Chris S Feb 6 '12 at 19:48
    
What OS? Is this a custom-compiled PHP? PHP normally consults different php.ini files based on whether it is called as a cli, cgi, or as an apache module (mod_php). Post the output of a web page with phpinfo(). Possibly multiple pages as you say the include path randomly changes. –  Mark Wagner Feb 7 '12 at 4:02
add comment

2 Answers

up vote 0 down vote accepted

The loaded configuration file in the phpinfo function should tell you. Make sure to restart http daemon after changes.

share|improve this answer
add comment

Are you running cPanel or any sort of control panel? If so, disregard what I'm about to say:

It sounds like you have at least two, possibly more installs of PHP on your machine. This typically happens when someone installs PHP via a package manager, then decides to recompile it to get a different version, and maybe recompiles again for a different option.

To start with, I'd suggest you remove every copy of PHP you can find on your system. Make sure you do your best to clean up after all of them (remove any modules or php.ini files you find). Once you've got a clean system, you need to decide what version of PHP you need, and reinstall it. You should install it via your package manager if it all possible (If you're using an OS that doesn't have the version of PHP you need installed, try to find an alternate sources for it. On CentOS, the IUS Repo is a good source).

Note that removing PHP may require you to remove Apache, and reinstall it. This depends on how everything was installed to begin with.

To prevent things like this from happening, try to avoid compiling software from source unless it is absolutely necessary. Your package manager can be your best friend if you actually use it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.