Search My Techie Guy

Showing posts with label red hat linux. Show all posts
Showing posts with label red hat linux. Show all posts

Tuesday, September 26, 2017

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/yy.so'

Summary: 
PHP Warning while trying to test PHP installation with a simple command "php -v"

NAME="Oracle Linux Server" 
VERSION="6.9"

Problem or Goal: 

 # php -v
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/curl.so' - /usr/lib/php/modules/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/dom.so' - /usr/lib/php/modules/dom.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/fileinfo.so' - /usr/lib/php/modules/fileinfo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/gd.so' - /usr/lib/php/modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/imap.so' - /usr/lib/php/modules/imap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/intl.so' - /usr/lib/php/modules/intl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/json.so' - /usr/lib/php/modules/json.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/ldap.so' - /usr/lib/php/modules/ldap.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mbstring.so' - /usr/lib/php/modules/mbstring.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysql.so' - /usr/lib/php/modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - /usr/lib/php/modules/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo.so' - /usr/lib/php/modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_mysql.so' - /usr/lib/php/modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_sqlite.so' - /usr/lib/php/modules/pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/phar.so' - /usr/lib/php/modules/phar.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/posix.so' - /usr/lib/php/modules/posix.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/snmp.so' - /usr/lib/php/modules/snmp.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/sqlite3.so' - /usr/lib/php/modules/sqlite3.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/sysvmsg.so' - /usr/lib/php/modules/sysvmsg.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/sysvsem.so' - /usr/lib/php/modules/sysvsem.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/sysvshm.so' - /usr/lib/php/modules/sysvshm.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/wddx.so' - /usr/lib/php/modules/wddx.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/xmlreader.so' - /usr/lib/php/modules/xmlreader.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/xmlwriter.so' - /usr/lib/php/modules/xmlwriter.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/xsl.so' - /usr/lib/php/modules/xsl.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/zip.so' - /usr/lib/php/modules/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP 5.3.3 (cli) (built: Jan 10 2017 22:26:04) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


Cause:
If you check the PHP's initialization file (php.ini), the problem here was the directory in which the loadable extensions (modules) reside. Usually the default directory in the php.ini is set to "/usr/lib/php/modules" but in my installation, i have "lib64" NOT "lib" and should therefore change to "/usr/lib64/php/modules"

Solution: 
You can run the command below to find location of the php modules on your installation. for example if you are looking for "json.so"
 [root@localhost]# find / -name json.so
/usr/lib64/php/modules/json.so

Before:


After:


Problem Solved?
# php -v
PHP 5.3.3 (cli) (built: Jan 10 2017 22:26:04) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

Tuesday, July 15, 2014

Mounting a DVD - Red Hat Enterprise 6.2

Insert the DVD in the DVD-ROM and run the following command:

# mkdir /media/redhat-dvd
# mount -t auto /dev/dvd /media/redhat-dvd
mount: block device /dev/sr0 is write-protected, mounting read-only


Run this command to check if the mounting was successful:

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_airtelug-lv_root
                       50G  1.7G   46G   4% /
tmpfs                  12G     0   12G   0% /dev/shm
/dev/sda1             485M   37M  423M   9% /boot
/dev/mapper/vg_airtelug-lv_home
                      195G  188M  185G   1% /home
/dev/sr0              3.4G  3.4G     0 100% /media/redhat-dvd
#

Enabling EPEL & DVD Repos for Red Hat Enterprise Linux 6.2

After a fresh installation of RedHat Enterprise Linux 6.2, my repolist was blank:

# yum repolist
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
repolist: 0

Note: Make sure your server has access to the internet and that DNS is correctly configured (You can use Google's Public DNS 8.8.8.8).

Enable the EPEL repo using the following command:

#  rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
Retrieving http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
warning: /var/tmp/rpm-tmp.GOjvJB: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

Check again to see if the epel repo has been enabled successfully:

# yum repolist
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
epel/metalink                                                                                                                                                                                             | 1.5 kB     00:00     
epel                                                                                                                                                                                                      | 4.4 kB     00:00     
epel/primary_db                                                                                                                                                                                           | 6.2 MB     00:03     
repo id                                                                                   repo name                                                                                                                        status
epel                                                                                      Extra Packages for Enterprise Linux 6 - x86_64                                                                                   10,998
repolist: 10,998

I noted one issue, even when my repolist show that epel is enable, i can't use it to install packages for example FTP:

# yum install ftp
Loaded plugins: product-id, security, subscription-manager
Updating certificate-based repositories.
Setting up Install Process
No package ftp available.
Error: Nothing to do

I checked the redhat.repo directory and realised it was empty even after adding the epel repo. so the repo won't work.

# cd /etc/yum.repos.d
# ls -ltr
total 16
-rw-r--r--. 1 root root  529 Nov  8  2011 rhel-source.repo
-rw-r--r--. 1 root root 1056 Nov  5  2012 epel-testing.repo
-rw-r--r--. 1 root root  957 Nov  5  2012 epel.repo
-rw-r--r--. 1 root root   78 Jul 15 19:21 redhat.repo

# more redhat.repo
#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#

The solution is to open a Red Hat account on http://www.redhat.com/
Register your server using this command and your red hat account login and password:

# rhn_register

Yet another issue was, i did NOT have a valid product subscription for the RHEL 6.2 i installed!
Yet i badly needed to install some packages to get my server running; for example the ftp packages and other small packages.

Solution is that the installation media/DVD has these packages, so you can add a repo to point to your RHEL DVD. Nice :-), i managed to get this to work, continue reading:

Insert the DVD in the DVD-ROM and mount it:
#mkdir /media/redhat-dvd
# mount -t ext4 /dev/dvd /media/redhat-dvd

check to make sure the mounting was OK:
[root@airtelug yum.repos.d]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_airtelug-lv_root
                       50G  1.7G   46G   4% /
tmpfs                  12G     0   12G   0% /dev/shm
/dev/sda1             485M   37M  423M   9% /boot
/dev/mapper/vg_airtelug-lv_home
                      195G  188M  185G   1% /home
/dev/sr0              3.4G  3.4G     0 100% /media/redhat-dvd
[root@airtelug yum.repos.d]#

create a .repo file
#cd  /etc/yum.repos.d
# touch redhat-dvd.repo
[root@airtelug yum.repos.d]# ls -ltr
total 16
-rw-r--r--. 1 root root  529 Nov  8  2011 rhel-source.repo
-rw-r--r--. 1 root root 1056 Nov  5  2012 epel-testing.repo
-rw-r--r--. 1 root root  957 Nov  5  2012 epel.repo
-rw-r--r--. 1 root root   78 Jul 15 19:21 redhat.repo
-rw-r--r--. 1 root root    0 Jul 15 19:49 redhat-dvd.repo
[root@airtelug yum.repos.d]#

copy the contents of the rhel-source.repo into you new dvd repo file

#cat rhel-source.repo > redhat-dvd.repo

Edit the dvd repo file to make sure that the fields are consistent with your choices:
see mine here:

[root@airtelug yum.repos.d]# more redhat-dvd.repo
[redhat-dvd]
name=RHEL-$releasever - dvd
baseurl=file:///media/redhat-dvd
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@airtelug yum.repos.d]#

so use vi to edit your repo file accordingly

#vi redhat-dvd.repo

Run yum repolist to update the repositories:

# yum repolist

Your new DVD repo should appear in the list.
You can now use your new DVD repo to search for and install packages

# yum search ftp
# yum install ftp

Leave a comment if you are having any issues related to adding a DVD repo and i will be glad to help :-)