Date Created: Wed 11-May-2011

Related Document Categories:


    CentOS 5.5

    Problem

    Cannot load mysql extension please check your PHP configuration



    I use CentOS as it is like RHEL without the branding and more akin to enterprise Linux implementations.

    I have looked around the net and not found some simple answers in one place. So you’ve installed CentOS/PHPMyAdmin/PHP/MySQLmore than once you’ll know what is more than likely wrong, but you cannot remember how you did it.

    The MySQL PHP module isn’t loaded. First of all, you must find your php.ini. It could be anywhere but if you create a small php file with the phpinfo(); command it will tell you where it is or you can use the following command line in CentOS.

    find / -name php.ini

    Typical result:

    /etc/php.ini

    rpm -ql php-mysql | grep mysql.so

    Typical result (64 bit Linux)

    /usr/lib64/php/modules/mysql.so


    Other common places include /etc/, /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini

    Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!

    ;extension=mysql.so

    should become

    extension=mysql.so

    if it is missing simply add it.

    Note:

    php.ini should have a line like:

    ; Directory in which the loadable extensions (modules) reside.
    extension_dir = "/usr/lib64/php/modules"

    if your mysql.so is located in /usr/lib64/php/modules/mysql.so

    restart httpd

    result


Middleware Mentor - Steven Charles Robinson

About Me

Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.

Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.

Follow Steve as @stevencrobinson on twitter.

Read my books?

IBM WebSphere Application Server 8.0 Administration Guide

IBM WebSphere Application Server 8.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Application Server 7.0 Administration Guide

WebSphere Categories

Oracle WebLogic Categories

JBoss Categories

Other Categories