LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   cli php missing modules as regular user but not as root (https://www.linuxquestions.org/questions/slackware-14/cli-php-missing-modules-as-regular-user-but-not-as-root-831287/)

jraidan 09-09-2010 08:10 PM

cli php missing modules as regular user but not as root
 
My cli php is missing modules as regular user but not as root. In particular, mysql is missing... which is how I came across this issue.

I'm running Slack 12.2 w/ php 5.2.14, standard Slack packages.

As a normal unprivileged user:

-> whoami ; php -v ; php -m |wc -l ; php -m |grep mysql
jerry
PHP 5.2.14 (cli) (built: Aug 25 2010 15:17:31)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
26

As root:

-> whoami ; php -v ; php -m |wc -l ; php -m | grep mysql
root
PHP 5.2.14 (cli) (built: Aug 25 2010 15:17:31)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
58
mysql
mysqli
pdo_mysql

I've tried reinstalling php and it made no difference. php.ini is not to blame. I've Google'd this to death, no luck. Anyone have a shove in the right direction or a clue to share for this problem?

TIA

Jerry

kbp 09-09-2010 08:41 PM

Root's PATH will usually be different to standard users.. can you run 'which php' as both users to see if it's actually the same executable ?

cheers

jraidan 09-09-2010 09:08 PM

They're exactly the same. /usr/bin/php

I have 3 other Slack 12.2 installs very similar to this one. Only one of them does not have this problem. I compared the installed packages & php configurations between all of the servers. The only differences are packages unrelated to php... proftp, jdk, and some X libraries. I use the same Slack mirror for all of these servers. Very bizarre.

Jerry

kbp 09-09-2010 09:36 PM

Maybe permissions on the actual module binaries ?

jraidan 09-09-2010 10:37 PM

donut think so...

-> ls -al /usr/lib/php/extensions/
total 4244K
drwxr-xr-x 2 root root 4096 2010-08-25 15:22 .
drwxr-xr-x 14 root root 4096 2010-08-25 15:13 ..
-rwxr-xr-x 1 root root 29896 2010-08-25 15:22 bcmath.so
-rwxr-xr-x 1 root root 19268 2010-08-25 15:22 bz2.so
-rwxr-xr-x 1 root root 24804 2010-08-25 15:22 calendar.so
-rwxr-xr-x 1 root root 10780 2010-08-25 15:22 ctype.so
-rwxr-xr-x 1 root root 57240 2010-08-25 15:22 curl.so
-rwxr-xr-x 1 root root 49532 2010-08-25 15:22 dba.so
-rwxr-xr-x 1 root root 27844 2010-08-25 15:22 dbase.so
-rwxr-xr-x 1 root root 47488 2010-08-25 15:22 exif.so
-rwxr-xr-x 1 root root 43152 2010-08-25 15:22 ftp.so
-rwxr-xr-x 1 root root 360716 2010-08-25 15:22 gd.so
-rwxr-xr-x 1 root root 8596 2010-08-25 15:22 gettext.so
-rwxr-xr-x 1 root root 39708 2010-08-25 15:22 gmp.so
-rwxr-xr-x 1 root root 32140 2010-08-25 15:22 iconv.so
-rwxr-xr-x 1 root root 40028 2010-08-25 15:22 ldap.so
-rwxr-xr-x 1 root root 1847224 2010-08-25 15:22 mbstring.so
-rwxr-xr-x 1 root root 6980 2010-08-25 15:22 mhash.so
-rwxr-xr-x 1 root root 44884 2010-08-25 15:22 mysql.so
-rwxr-xr-x 1 root root 98288 2010-08-25 15:22 mysqli.so
-rwxr-xr-x 1 root root 81732 2010-08-25 15:22 openssl.so
-rwxr-xr-x 1 root root 86164 2010-08-25 15:22 pdo.so
-rwxr-xr-x 1 root root 23004 2010-08-25 15:22 pdo_mysql.so
-rwxr-xr-x 1 root root 394048 2010-08-25 15:22 pdo_sqlite.so
-rwxr-xr-x 1 root root 19484 2010-08-25 15:22 pspell.so
-rwxr-xr-x 1 root root 7524 2010-08-25 15:22 shmop.so
-rwxr-xr-x 1 root root 23012 2010-08-25 15:22 snmp.so
-rwxr-xr-x 1 root root 314920 2010-08-25 15:22 soap.so
-rwxr-xr-x 1 root root 336796 2010-08-25 15:22 sqlite.so
-rwxr-xr-x 1 root root 14072 2010-08-25 15:22 tokenizer.so
-rwxr-xr-x 1 root root 29124 2010-08-25 15:22 wddx.so
-rwxr-xr-x 1 root root 24208 2010-08-25 15:22 xsl.so
-rwxr-xr-x 1 root root 65876 2010-08-25 15:22 zip.so
-rwxr-xr-x 1 root root 25620 2010-08-25 15:22 zlib.so

kbp 09-10-2010 01:36 AM

Can you create/visit a phpinfo page ?

ponce 09-10-2010 01:40 AM

I've tried on my installs, creating another generic user and it can see all the modules, extensions included.
Then I saw in "man php" the -n option, that starts php without reading the .ini file and launching it like this it shows only the builtin modules.
I think in your case is not finding/reading that file (so he doesn't activate extensions): maybe you have to launch it specifying with the -c option the location of the php.ini.

obviously, I would check also if your user can read it making him issue a
Code:

cat /path/to/php.ini
can be also some directory permission are changed from the default (you tell us on one machine it works ok: I think a clean slack 12.2 don't behave like that -I tried on -current).

jraidan 09-10-2010 07:18 AM

A fresh day with a fresh set of eyes (and a few cups of coffee) revealed that it was the permissions on the php.ini file. /etc/httpd/php.ini was missing +r for all users. Running the command "php -c /etc/httpd/php.ini -m" didn't throw a "Permission denied" error so I didn't think to check the read permissions of the file. *slaps forehead*

Many thanks to everyone that chimed in with suggestions, much appreciated!


All times are GMT -5. The time now is 08:28 AM.