我试图安装cakePHP 3.0.0与WT-NMP,但我得到了这样的消息:
CakePHP无法连接到数据库。
数据库驱动程序Cake\Database\Driver\Mysql由于缺少PHP扩展或未满足的依赖项而无法使用
我的php.ini有这个:
extension = php_bz2.dll
extension = php_curl.dll
extension = php_gd2.dll
extension = php_imap.dll
extension = php_mbstring.dll
extension = php_exif.dll
extension = php_mysql.dll
extension = php_mysqli.dll
extension = php_pdo_mysql.dll
extension = php_pdo.dll
extension = php_soap.dll
extension = php_sockets.dll
extension = php_sqlite3.dll
extension = php_openssl.dll
extension = php_fileinfo.dll
extension = php_intl.dll
app.php有这个
'default' => [
'className' => 'Cake\Database\Connection',
'driver' => 'Cake\Database\Driver\Mysql',
'persistent' => false,
'host' => 'localhost',
/**
* CakePHP will use the default DB port based on the driver selected
* MySQL on MAMP uses port 8889, MAMP users will want to uncomment
* the following line and set the port accordingly
*/
'port' => '3306',
'username' => 'root',
'password' => '',
'database' => 'test',
'encoding' => 'utf8',
'timezone' => 'UTC',
'cacheMetadata' => true,
我错过了什么?或者这是cakePHP 3.0的bug?或者任何与WT-NMP有关的东西。我已经被卡住了一整天。
6条答案
按热度按时间pinkon5k1#
幸运地解决了这个问题!:
bogh5gae2#
安装modules for MySQL database connections为我解决了这个问题:
来源:http://guru4cakephp.blogspot.nl/2015/04/install-cakephp-3-on-ubuntu.html
Package 详情:https://packages.debian.org/sid/php5-mysql
jobtbby33#
试试这个:
PHP 7.0
对于PHP 5:
nhhxz33t4#
错误消息是因为
extension = php_pdo_mysql.dll
没有在php.ini
中安装和启用。如果您没有启用php_intl.dll
,则在检查数据库连接之前会收到错误消息。您的
php.ini
表明您已经启用了php_pdo_mysql.dll
,但是可能您需要重新启动CakePHP服务器bin/cake server
。h43kikqp5#
不要仅仅依赖于php.ini的阅读。只要检查你是否安装了php[v]-mysql扩展。你可以检查php_mysql.dll是否存在于你的windows服务器的php扩展目录(最有可能是
<path to your php installation>/ext
)中。在linux中,你可以使用以下命令检查它是否安装。它将列出所有已安装的php扩展。
jrcvhitl6#
对于Windows: