在Centos下安装的PHP 5.3.3版本后,启动Wordpress显示

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

解决办法

先查看下文件夹/usr/lib/php/modules/中是否有mysql的so文件,若没有则安装上,如下

[algony@centos wp]$ ls -l /usr/lib/php/modules/
total 2.3M
drwxr-xr-x. 2 root root 4.0K Sep  1 01:24 ./
drwxr-xr-x. 4 root root 4.0K Sep  1 01:24 ../
-rwxr-xr-x. 1 root root  65K Jul 13 04:26 curl.so*
-rwxr-xr-x. 1 root root 1.8M Jul 13 04:26 fileinfo.so*
-rwxr-xr-x. 1 root root  33K Jul 13 04:26 json.so*
-rwxr-xr-x. 1 root root 260K Jul 13 04:26 phar.so*
-rwxr-xr-x. 1 root root  80K Jul 13 04:26 zip.so*
[algony@centos wp]$ sudo yum search php-mysql #搜索下最新的module
...
[algony@centos wp]$ sudo yum install php-mysql.i686
...
[algony@centos wp]$ ls -l /usr/lib/php/modules/
total 2.6M
drwxr-xr-x. 2 root root 4.0K Sep  1 21:55 ./
drwxr-xr-x. 4 root root 4.0K Sep  1 01:24 ../
-rwxr-xr-x. 1 root root  65K Jul 13 04:26 curl.so*
-rwxr-xr-x. 1 root root 1.8M Jul 13 04:26 fileinfo.so*
-rwxr-xr-x. 1 root root  33K Jul 13 04:26 json.so*
-rwxr-xr-x. 1 root root 119K Jul 13 04:26 mysqli.so*
-rwxr-xr-x. 1 root root  45K Jul 13 04:26 mysql.so*
-rwxr-xr-x. 1 root root  26K Jul 13 04:26 pdo_mysql.so*
-rwxr-xr-x. 1 root root  89K Jul 13 04:26 pdo.so*
-rwxr-xr-x. 1 root root  21K Jul 13 04:26 pdo_sqlite.so*
-rwxr-xr-x. 1 root root 260K Jul 13 04:26 phar.so*
-rwxr-xr-x. 1 root root  41K Jul 13 04:26 sqlite3.so*
-rwxr-xr-x. 1 root root  80K Jul 13 04:26 zip.so*

再在/etc/php.ini中加入下面这几句:

extension=msql.so
extension=mysqli.so
extension=pdo_MySQL.so

最后重启httpd即可

[algony@centos wp]$ sudo service httpd restart
Stopping httpd:                                [  OK  ]
Starting httpd:                                [  OK  ]

Leave a Reply

Your email address will not be published.

Post Navigation