PHP Extensions showing in CLI, not in Apache Module

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

PHP Extensions showing in CLI, not in Apache Module

Post by RobertGonzalez »

I just compiled and installed the sybase module for PHP. When I run a php -m from the CLI, it shows up...

Code: Select all

[root@localhost]# php -m
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dba
dom
exif
ftp
gd
gettext
gmp
hash
iconv
imap
ldap
libxml
mbstring
mime_magic
mysql
mysqli
ncurses
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_pgsql
pgsql
posix
pspell
Reflection
session
shmop
SimpleXML
snmp
soap
sockets
SPL
standard
sybase_ct <-- HERE IT IS
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
zlib
But when I run get_loaded_extensions() in a script, I get this...

Code: Select all

Array
(
    [0] => libxml
    [1] => xml
    [2] => wddx
    [3] => tokenizer
    [4] => sysvshm
    [5] => sysvsem
    [6] => sysvmsg
    [7] => standard
    [8] => SimpleXML
    [9] => sockets
    [10] => SPL
    [11] => shmop
    [12] => session
    [13] => Reflection
    [14] => pspell
    [15] => posix
    [16] => mime_magic
    [17] => iconv
    [18] => hash
    [19] => gmp
    [20] => gettext
    [21] => ftp
    [22] => exif
    [23] => date
    [24] => curl
    [25] => ctype
    [26] => calendar
    [27] => bz2
    [28] => zlib
    [29] => pcre
    [30] => openssl
    [31] => apache2handler
    [32] => bcmath
    [33] => dba
    [34] => dom
    [35] => gd
    [36] => imap
    [37] => ldap
    [38] => mbstring
    [39] => mysqli
    [40] => mysql
    [41] => ncurses
    [42] => odbc
    [43] => PDO
    [44] => pdo_mysql
    [45] => PDO_ODBC
    [46] => pdo_pgsql
    [47] => pgsql
    [48] => snmp
    [49] => soap
    [50] => xmlreader
    [51] => xmlrpc
    [52] => xmlwriter
    [53] => xsl
)
Notice, there is no sybase in there? What the f....? How do I get the Sybase extension to load so that I cna hit it with a script?

EDIT | Ok, I tried to enable the extension dynamically at runtime (using dl()) and I got this...
Warning: dl() [function.dl]: Unable to load dynamic library '/usr/lib/php/modules/sybase_ct.so' - libsybtcl.so: failed to map segment from shared object: Permission denied in /var/www/html/tests/sybase-test-proc.php on line 8
The weird thing is that I can connect at the CLI with no problems. Does anyone have any idea what this means?
iluxa
Forum Newbie
Posts: 15
Joined: Wed Nov 29, 2006 3:29 am

Post by iluxa »

CLI and Apache module probably use different php.ini file. Find one that is used by the module,
find section that describes extensions to load, and add your sybase extension there.
(Check the CLI file on what to add, since CLI has it working correctly)
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I think I may have found out what this is all about. Apparently, if SELinux is enabled, you stand a good chance at having a lot of Permission Denied related errors. I found something similar to what I am experiencing, and a possible fix, at this link.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

It's possible to build the cli executable with different options than the apache module. php -i or <?php phpinfo(); ?> show the build options.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

NOTE: This is a Red Hat Enterprise Linux server running the Red Hat Application Stack. I did notice that SELinux is ENFORCING on this machine, where as the machine that runs Fedora Core 5 SELinux is PERMISSIVE. I changed that setting in the selinux config file and am waiting for the sys admin to reboot the machine. For the record...

#> php -i
Compiled in modules (Configure Command section)...

Code: Select all

'./configure'
'--build=i386-redhat-linux'
'--host=i386-redhat-linux'
'--target=i386-redhat-linux-gnu'
'--program-prefix='
'--prefix=/usr'
'--exec-prefix=/usr'
'--bindir=/usr/bin'
'--sbindir=/usr/sbin'
'--sysconfdir=/etc'
'--datadir=/usr/share'
'--includedir=/usr/include'
'--libdir=/usr/lib'
'--libexecdir=/usr/libexec'
'--localstatedir=/var'
'--sharedstatedir=/usr/com'
'--mandir=/usr/share/man'
'--infodir=/usr/share/info'
'--cache-file=../config.cache'
'--with-libdir=lib'
'--with-config-file-path=/etc'
'--with-config-file-scan-dir=/etc/php.d'
'--disable-debug'
'--with-pic'
'--disable-rpath'
'--without-pear'
'--with-bz2'
'--with-curl'
'--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr'
'--with-png-dir=/usr'
'--enable-gd-native-ttf'
'--without-gdbm'
'--with-gettext'
'--with-gmp'
'--with-iconv'
'--with-jpeg-dir=/usr'
'--with-openssl'
'--with-png'
'--with-pspell'
'--with-expat-dir=/usr'
'--with-pcre-regex=/usr'
'--with-zlib'
'--with-layout=GNU'
'--enable-exif'
'--enable-ftp'
'--enable-magic-quotes'
'--enable-sockets'
'--enable-sysvsem'
'--enable-sysvshm'
'--enable-sysvmsg'
'--enable-track-vars'
'--enable-trans-sid'
'--enable-yp'
'--enable-wddx'
'--with-kerberos'
'--enable-ucd-snmp-hack'
'--with-unixODBC=shared,/usr'
'--enable-memory-limit'
'--enable-shmop'
'--enable-calendar'
'--enable-dbx'
'--enable-dio'
'--with-mime-magic=/etc/httpd/conf/magic'
'--without-sqlite'
'--with-libxml-dir=/usr'
'--with-xml'
'--enable-force-cgi-redirect'
'--enable-pcntl'
'--with-imap=shared'
'--with-imap-ssl'
'--enable-mbstring=shared'
'--enable-mbstr-enc-trans'
'--enable-mbregex'
'--with-ncurses=shared'
'--with-gd=shared'
'--enable-bcmath=shared'
'--enable-dba=shared'
'--with-db4=/usr'
'--with-xmlrpc=shared'
'--with-ldap=shared'
'--with-mysql=shared,/usr'
'--with-mysqli=shared,/usr/bin/mysql_config'
'--enable-dom=shared'
'--with-dom-xslt=/usr'
'--with-dom-exslt=/usr'
'--with-pgsql=shared'
'--with-snmp=shared,/usr'
'--enable-soap=shared'
'--with-xsl=shared,/usr'
'--enable-xmlreader=shared'
'--enable-xmlwriter=shared'
'--enable-fastcgi'
'--enable-pdo=shared'
'--with-pdo-odbc=shared,unixODBC,/usr'
'--with-pdo-mysql=shared,/usr'
'--with-pdo-pgsql=shared,/usr'
'--without-pdo-sqlite'
...

Code: Select all

sybase_ct

Sybase_CT Support => enabled
Active Persistent Links => 0
Active Links => 0
Min server severity => 10
Min client severity => 10
Application Name => PHP 5.1.4
Deadlock retry count => -1

Directive => Local Value => Master Value
sybct.allow_persistent => On => On
sybct.deadlock_retry_count => Unlimited => Unlimited
sybct.hostname => no value => no value
sybct.max_links => Unlimited => Unlimited
sybct.max_persistent => Unlimited => Unlimited
sybct.min_client_severity => 10 => 10
sybct.min_server_severity => 10 => 10
Post Reply