我正在尝试使用php5 fpm和nginx以及远程服务器上的数据库来完成wordpress的安装。然而,wordpress不承认mysql的存在,不允许我连接到远程数据库。
php中用于检查mysql扩展是否已加载的代码表示扩展未加载:
<?php
var_dump(extension_loaded(\'mysql\'));
mysql_connect();
结果如下:
bool(false)
PHP message: PHP Fatal error: Call to undefined function mysql_connect() in /path/www/check.php on line 3
然而,似乎到处都表明
should 有必要(php5 fpm、php5 mysql、mysql client、wordpress),只是本地服务器必须运行mysql服务器,因为它位于远程服务器上。
那么,为了使加载的扩展名(\'mysql\')与其他所有内容都处于正确的状态,我应该寻找什么呢?
安装的各种依赖项的输出如下:
apt-cache policy mysql-client
mysql-client:
Installed: 5.5.43-0ubuntu0.14.04.1
Candidate: 5.5.43-0ubuntu0.14.04.1
Version table:
*** 5.5.43-0ubuntu0.14.04.1 0
500 http://mirror.rackspace.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://mirror.rackspace.com/ubuntu/ trusty-security/main amd64 Packages
100 /var/lib/dpkg/status
5.5.35+dfsg-1ubuntu1 0
500 http://mirror.rackspace.com/ubuntu/ trusty/main amd64 Packages
apt-cache policy mysql-server
mysql-server:
Installed: (none)
Candidate: 5.5.43-0ubuntu0.14.04.1
Version table:
5.5.43-0ubuntu0.14.04.1 0
500 http://mirror.rackspace.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://mirror.rackspace.com/ubuntu/ trusty-security/main amd64 Packages
5.5.35+dfsg-1ubuntu1 0
500 http://mirror.rackspace.com/ubuntu/ trusty/main amd64 Packages
还安装了php5 mysql。
我的wordpress版本:
wp core version --extra
WordPress version: 4.1.1
Database revision: 30133
TinyMCE version: 4.107 (4107-20150118)
Php5版本:
php --version
PHP 5.5.9-1ubuntu4.9 (cli) (built: Apr 17 2015 11:44:57)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
php5 fpm配置
php5-fpm -i | grep mysql
/etc/php5/fpm/conf.d/20-mysql.ini,
/etc/php5/fpm/conf.d/20-mysqli.ini,
/etc/php5/fpm/conf.d/20-pdo_mysql.ini,
mysql
MYSQL_SOCKET => /var/run/mysqld/mysqld.sock
MYSQL_INCLUDE => -I/usr/include/mysql
MYSQL_LIBS => -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MYSQLI_SOCKET => /var/run/mysqld/mysqld.sock
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
PDO drivers => mysql, pgsql
pdo_mysql
pdo_mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock