CentOS / RHEL: Install MySQL PHP Extension

Posted on in Categories , , last updated July 1, 2010

How do I install a module or extension for PHP applications that use MySQL databases under CentOS / Redhat / RHEL / Fedora Linux?

You need to install php-mysql module using the yum command which contains a dynamic shared object that will add MySQL database support to PHP. MySQL is an object-relational database management system. PHP is an HTML-embeddable scripting language. If you need MySQL support for PHP applications, you will need to install this package and the php package:
# yum install php php-mysql httpd

Finally, restart apache web server:
# service httpd restart

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on Twitter, Facebook, Google+.

3 comment

  1. Hi,

    Can you help me to resolve php-mysql extension configuration problem?

    I had RHL enterprise 5 installed on my server and found that the PHP installed has
    no php-mysql support from phpinfo().

    I tried your suggested instruction of :

    yum install php php-mysql httpd

    and got the following response? What do I have to do to resolve this?

    [[email protected] ~]# yum install php php-mysql httpd
    Loaded plugins: rhnplugin, security
    This system is not registered with RHN.
    RHN support will be disabled.
    Setting up Install Process
    Nothing to do

    Thanks for any info

    Jeff

  2. I hv installed this, and I got this message when I tried to install wordpress,

    Your PHP installation appears to be missing the MySQL extension which is required by WordPress.

    How can I fix it ?
    thanks

Leave a Comment