I got new server and installed phpMyAdmin. But whenever I visit the phpmyadmin url it says:

Cannot load mysql extension. Please check your PHP configuration

How do I fix this problem under CentOS / RHEL / Fedora Linux Apache web server?

You need to install php-mysql which is a module for PHP applications that use MySQL databases. You may also need to install the following:

  • php-mysql : Module for PHP applications that use MySQL databases
  • php-gd : A module for PHP applications for using the gd graphics library
  • php-mbstring : A module for PHP applications which need multi-byte string handling
  • php-mcrypt : Standard PHP module provides mcrypt library support

Type the following command to fix your issue:
# yum -y install php-mysql
# service httpd graceful

# apachectl -k graceful
No need to edit /etc/php.ini as php-mysql package comes pre configured with /etc/php.d/mysql.ini file:
# cat /etc/php.d/mysql.ini
Sample outputs:

; Enable mysql extension module

Optional Modules

To install other modules type:
# yum -y install php-mbstring php-mcrypt php-gd
# service httpd graceful

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Pablo Oct 14, 2011 @ 8:03

    Thank you, Works fine for me.

  • shels Nov 13, 2011 @ 4:55

    No package php-mcrypt available

  • Charles Apr 20, 2012 @ 19:00

    Great post, I was able to connect immediately.

  • nelyyva Sep 7, 2012 @ 10:26

    thanks a lot, this saved my day!!

  • zion Dec 26, 2012 @ 6:01

    thanks , it solved myproblem .

  • vahid Sep 20, 2015 @ 5:40

    hey dude.. where should i type that command?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum