tags:

views:

33

answers:

2

As far as I can tell, there's no difference between the error reporting or message redirection between users. They both use the same PHP ini.

However, when I run a script as a regular user, I get tons of NOTICES, when run as root, I get none. When starting PHP interactive mode as a regular user, I get two PHP Warnings that 'memcache' and 'xmlwriter' are already loaded; when starting as the root user, I get no warnings.

I know that I should be fixing the warnings, not "making the warnings go away;" that's on the ticket. The question is, Why are the users treated differently? Why does a regular user get notices and warnings, but root does not, even if their error reporting are the same?

+1  A: 

It's likely that the actual PHP binary that you're executing is different due to differences in your $PATH. You may have a copy of PHP installed in /usr/bin that uses shared modules for memcache, and another in /usr/local/bin that has it statically linked.

Both executables may reference /etc/php.ini for their configuration. If the configuration file is telling PHP to try to load a shared module, the copy that has it statically linked will generate the errors you're getting.

Try the command which php as the normal user and root, which should report back the location of the PHP executable. You can also say echo $PATH as each user to see the directories it's searching. You may need to add/remove a directory from the $PATH, which you should be able to do in your ~/.profile file.

awgy
Thanks, I've checked this and it appears that they are using the same binary, and neither have any differences in ~/.profile.Thanks for your efforts; at this point I'm just going to assume "that's the way PHP does it," that PHP suppresses warnings for root that make it through for regular users. I can duplicate the effect by changing the bitflags in the error_reporting variable.
Shawn
A: 

Something is different in the environment.

What if you try investigating like this:

$ php -i > mortal
$ su php -i > root
$ diff mortal root
timdev