php 5.1.6 and GD module problems.

Support for webhosts that use CentOS
marguierp
Posts: 1
Joined: 2014/06/24 18:45:21

php 5.1.6 and GD module problems.

Postby marguierp » 2014/06/24 19:17:44

Hi,

I am trying to use the GD module for php, I have installed it with yum install php-gd
but in the message log I can see this line repeated a number of time.

Jun 24 19:32:50 WMPP004 php: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/gd.so' - libpng12.so.0: cannot open shared object file: Permission denied in n on line 0

I did some investigation:

[root@WMPP004 modules]# ldd /usr/lib64/php/modules/gd.so
linux-vdso.so.1 => (0x00007fff59f40000)
libfreetype.so.6 => /usr/lib64/libfreetype.so.6 (0x00002b291c7f1000)
libpng12.so.0 => /usr/lib64/libpng12.so.0 (0x00002b291ca75000)
libz.so.1 => /lib64/libz.so.1 (0x00002b291cc9a000)
libjpeg.so.62 => /usr/lib64/libjpeg.so.62 (0x00002b291ceae000)
libc.so.6 => /lib64/libc.so.6 (0x00002b291d0d0000)
libm.so.6 => /lib64/libm.so.6 (0x00002b291d42a000)
/lib64/ld-linux-x86-64.so.2 (0x0000003b86a00000)
[root@WMPP004 modules]#

It complains about permission, "Permission denied" so I went to /usr/lib64 to check permissions and they looks correct to me.

[root@WMPP004 lib64]# pwd
/usr/lib64
[root@WMPP004 lib64]# ls -Zall libpng*
-rw-r--r-- 1 system_u:object_r:lib_t root root 241936 Apr 25 2012 libpng12.a
lrwxrwxrwx 1 system_u:object_r:lib_t root root 18 Jun 24 14:20 libpng12.so -> libpng12.so.0.10.0
lrwxrwxrwx 1 system_u:object_r:file_t root root 18 May 14 2012 libpng12.so.0 -> libpng12.so.0.10.0
-rwxr-xr-x 1 system_u:object_r:file_t root root 149344 Apr 25 2012 libpng12.so.0.10.0
lrwxrwxrwx 1 system_u:object_r:lib_t root root 10 Jun 24 14:20 libpng.a -> libpng12.a
lrwxrwxrwx 1 system_u:object_r:lib_t root root 11 Jun 24 14:20 libpng.so -> libpng12.so
lrwxrwxrwx 1 system_u:object_r:file_t root root 16 May 14 2012 libpng.so.3 -> libpng.so.3.10.0
-rwxr-xr-x 1 system_u:object_r:file_t root root 160184 Apr 25 2012 libpng.so.3.10.0
[root@WMPP004 lib64]#

Have you seen this problem before ?

bye
Philippe Marguier

User avatar
TrevorH
Forum Moderator
Posts: 21162
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: php 5.1.6 and GD module problems.

Postby TrevorH » 2014/06/25 00:22:52

You have a number of files in that list that have the wrong selinux context on them. All the ones in that list that say "system_u:object_r:file_t" should not do so, they are all mislabeled. I recommend that you, as root, perform the following, first edit /etc/sysconfig/selinux and make sure that it says SELINUX=permissive and not enforcing and then

Code: Select all

touch /.autorelabel
shutdown -r now


The reboot may take longer than usual due to the relabel but since I do not know how those files got the wrong label nor how many others there are, it's safest to relabel the entire system. Once your system comes back up after the relabel, edit /etc/sysconfig/selinux and put it back to enforcing. If you want to make sure that it works then reboot again or you can change to enforcing on the fly by running setenforce 1
CentOS 5 died in March 2017 - migrate NOW!
Full time Geek, part time moderator. Use the FAQ Luke

Harryjames
Posts: 2
Joined: 2014/08/19 11:41:55

Re: php 5.1.6 and GD module problems.

Postby Harryjames » 2014/08/19 12:19:36

You can use sestatus commands to enable Selinux.

~]$ sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted