ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Unable to load dynamic library
Posted by Carlton on Oct-06-2005 13:44
system: Linux dev 2.6.13-1.1526_FC4smp #1 SMP Wed Sep 28 19:30:04 EDT 2005 i686
extension dir: /usr/lib/php/modules
Apache/2.0.54 (Fedora)
php: 5.0.4
dl() enabled

[root@dev modules]# pwd
/usr/lib/php/modules
[root@dev modules]# ldd *.dll
        linux-gate.so.1 =>  (0x00c0c000)
        libc.so.6 => /lib/libc.so.6 (0x00560000)
        /lib/ld-linux.so.2 (0x003db000)
[root@dev modules]# ldd *.so
ldap.so:
        linux-gate.so.1 =>  (0x00d1d000)
        libldap-2.2.so.7 => /usr/lib/libldap-2.2.so.7 (0x00111000)
        liblber-2.2.so.7 => /usr/lib/liblber-2.2.so.7 (0x006d1000)
        libc.so.6 => /lib/libc.so.6 (0x001eb000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x00a23000)
        libsasl2.so.2 => /usr/lib/libsasl2.so.2 (0x00c21000)
        libssl.so.5 => /lib/libssl.so.5 (0x00547000)
        libcrypto.so.5 => /lib/libcrypto.so.5 (0x0057f000)
        /lib/ld-linux.so.2 (0x003db000)
        libdl.so.2 => /lib/libdl.so.2 (0x00f18000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x00d50000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00147000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00f45000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x00e6f000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x006a2000)
        libz.so.1 => /usr/lib/libz.so.1 (0x0015f000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00172000)
libchartdir.so:
        linux-gate.so.1 =>  (0x0086d000)
        libdl.so.2 => /lib/libdl.so.2 (0x00111000)
        libm.so.6 => /lib/libm.so.6 (0x00f21000)
        libc.so.6 => /lib/libc.so.6 (0x00179000)
        /lib/ld-linux.so.2 (0x003db000)
mysqli.so:
        linux-gate.so.1 =>  (0x005c0000)
        libmysqlclient.so.14 => /usr/lib/mysql/libmysqlclient.so.14 (0x00d76000)        libz.so.1 => /usr/lib/libz.so.1 (0x007c4000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x002e0000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00111000)
        libm.so.6 => /lib/libm.so.6 (0x00c1c000)
        libssl.so.5 => /lib/libssl.so.5 (0x0090c000)
        libcrypto.so.5 => /lib/libcrypto.so.5 (0x001ae000)
        libc.so.6 => /lib/libc.so.6 (0x00648000)
        /lib/ld-linux.so.2 (0x003db000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00423000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00127000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x0062e000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x002bb000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x00199000)
        libdl.so.2 => /lib/libdl.so.2 (0x0030e000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00312000)
mysql.so:
        linux-gate.so.1 =>  (0x006d1000)
        libmysqlclient.so.14 => /usr/lib/mysql/libmysqlclient.so.14 (0x0078b000)        libc.so.6 => /lib/libc.so.6 (0x009a3000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x002f6000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x00be7000)
        libm.so.6 => /lib/libm.so.6 (0x00f89000)
        libssl.so.5 => /lib/libssl.so.5 (0x0056c000)
        libcrypto.so.5 => /lib/libcrypto.so.5 (0x00111000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00b2d000)
        /lib/ld-linux.so.2 (0x003db000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00c63000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x0021e000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x0074d000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00f4b000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x00290000)
        libdl.so.2 => /lib/libdl.so.2 (0x002a3000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x002a7000)
pgsql.so:
        linux-gate.so.1 =>  (0x00ec1000)
        libpq.so.4 => /usr/lib/libpq.so.4 (0x00251000)
        libc.so.6 => /lib/libc.so.6 (0x00b7d000)
        libssl.so.5 => /lib/libssl.so.5 (0x0048d000)
        libcrypto.so.5 => /lib/libcrypto.so.5 (0x008f9000)
        libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x00111000)
        libcrypt.so.1 => /lib/libcrypt.so.1 (0x001a0000)
        libresolv.so.2 => /lib/libresolv.so.2 (0x001ce000)
        libnsl.so.1 => /lib/libnsl.so.1 (0x001e1000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x001f7000)
        /lib/ld-linux.so.2 (0x003db000)
        libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00209000)
        libcom_err.so.2 => /lib/libcom_err.so.2 (0x00eeb000)
        libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x002d5000)
        libdl.so.2 => /lib/libdl.so.2 (0x00f00000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00221000)
        libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00183000)
[root@dev modules]# ll
total 4244
drwxr-xr-x  2 root root    4096 Dec 31  1969 fonts
-rwxr-xr-x  1 root root   40500 Aug 17 06:55 ldap.so
-rwxr-xr-x  1 root root 4015872 Oct  4 20:16 libchartdir.so
-rwxr-xr-x  1 root root   89368 Aug 17 06:55 mysqli.so
-rwxr-xr-x  1 root root   45644 Aug 17 06:55 mysql.so
-rwxr-xr-x  1 root root   86508 Aug 17 06:55 pgsql.so
-rwxr-xr-x  1 root root    8760 Oct  5 21:57 phpchartdir503.dll


output in httpd error log
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phpchartdir503.dll' - /usr/lib/php/modules/phpchartdir503.dll: cannot enable executable stack as shared object requires: Permission denied in Unknown on line 0

output from test page
Warning: dl() [function.dl]: Unable to load dynamic library '/usr/lib/php/modules/phpchartdir503.dll' - /usr/lib/php/modules/phpchartdir503.dll: cannot enable executable stack as shared object requires: Permission denied in /var/www/html/software/dl.php on line 3

I even tried loading in a different dir and that didnt work either.

Thanks,
Carlton

  Re: Unable to load dynamic library
Posted by Peter Kwan on Oct-06-2005 22:20
Hi Carlton,

This is the first time I saw this error message. By searching google, it seems to suggest some security restrictions is in place, so that the kernel refuses to load ChartDirector.

Would you mind to confirm if this is a standard Fedora Core 4, and a standard Apache/PHP that comes with Fedora Core 4? (I assume you have not customized the kernel or compile you own Apache/PHP, etc). I will try to see if I can reproduce the problem.

In the mean time, I suspect the problem is related to "kernle exec shield" security protection. I search google and found several things you may try:

1. Try to login as root and issue the command:

execstack -s xxxxx

where xxxxx is your Apache executable. Then restart Apache

2. You may try to login as root and use:

echo 0 > /proc/sys/kernel/exec-shield

Then restart Apache. You may also need to reboot the server.

Regards
Peter Kwan

  Re: Unable to load dynamic library
Posted by Carlton on Oct-06-2005 23:44
Thanks,
The execstack -s /dir/to/httpd worked.

I dont know what that does but it is working now.

Carlton

  dl(): cannot open shared object file: Permission denied
Posted by Bill on Jan-31-2011 09:11
After hours googling and drinking coffee, I am just exhausted and cannot find any solution to my actual problem. In fact, I cannot load  "phpchartdir520.dll" dynamicaly for some reason I really do not understand. There is no problem with permissions for sure because Apache user has full access to the shared object library. Moreover extension directory is set correctly ...

Could someone help me, thanks !


Trying to load "phpchartdir520.dll" from the PHP extension directory "/usr/lib/php/modules".

dl(): Unable to load dynamic library '/usr/lib/php/modules/phpchartdir520.dll' - /usr/lib/php/modules/phpchartdir520.dll: cannot open shared object file: Permission denied


System Information
Operating System : Linux dapr.localdomain 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:35:01 EDT 2007 i686
PHP version : 5.2.6
PHP / Web Server interface : apache2handler
PHP configuration file location : "/etc/php.ini"
PHP extension directory : "/usr/lib/php/modules"

  Re: dl(): cannot open shared object file: Permission denied
Posted by Peter Kwan on Jan-31-2011 17:58
Hi Bill,

The phpchartdir520.dll is not loaded by Apache. It is loaded by PHP. The PHP may or may not be running in the same process as Apache. It depends on how you configure your PHP/Apache interface. So it may or may not be sufficient for the "Apache user" to have access to the shared object.

Depending on your Apache configuration, sometimes the object is accessed under the security privilege of the "anonymous user", which may not be the same as the "Apache user".

Also, are you using Secure Linux extension (SELinux)? If you use SELinux, the security settings listed using "ls -l" may not be the fully security settings. There may be other hidden settings. Even if the shared objects appeared to be readable and executable by "everyone", it may still not be readable and executable by Apache or PHP. (Try sestatus to see if SELinux is enabled.)

For testing, you may consider to enable "everyone" read and executable access to the shared objects, and disable SELinux. After it works, you can always tighten the security settings.

If the above still cannot solve the problem, would you mind to provide the output when the following is used:

uname -a
sestatus
cd /usr/lib/php/modules
pwd
ls -l
ls -Z

Hope this can help.

Regards
Peter Kwan

  Re: dl(): cannot open shared object file: Permission denied
Posted by Bill on Feb-01-2011 22:05
Thanks but I managed the problem without disabling Selinux.

  Re: dl(): cannot open shared object file: Permission denied
Posted by Jeff on May-30-2013 01:33
Thank you so much. I have been fighting this problem for a day and a half and changing the selinux setting from "enforcing" to "permissive" solved the problem immediately. This was an incredible waste of time and it would be great if selinux could provide a bit more useful information in the Apache error log as to why the DLL is failing to load and how to properly resolve the problem.