gpt4 book ai didi

PHP 5.4.9 未定义的类常量 'MYSQL_ATTR_INIT_COMMAND'

转载 作者:行者123 更新时间:2023-11-29 13:22:52 25 4
gpt4 key购买 nike

我正在尝试按照 this 配置原则教程以及当我运行该命令时:./vendor/bin/doctrine-module orm:validate-schema 我收到错误:

第 19 行 var/www/CommunicationApp/config/autoload/global.php 中未定义的类常量“MYSQL_ATTR_INIT_COMMAND”

这是 global.php 文件:

<?php
/**
* Global Configuration Override
*
* You can use this file for overriding configuration values from modules, etc.
* You would place values in here that are agnostic to the environment and not
* sensitive to security.
*
* @NOTE: In practice, this file will typically be INCLUDED in your source
* control, so do not include passwords or other sensitive information in this
* file.
*/

return array(
'db' => array(
'driver' => 'Pdo',
'dsn' => 'mysql:dbname=zf2tutorial;host=localhost',
'driver_options' => array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
),
),
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter'
=> 'Zend\Db\Adapter\AdapterServiceFactory',
),
),
);

我已经在/usr/local/zend/etc/php.ini 中取消注释了 extension=php_pdo_mysql.dll

最佳答案

确保您已安装 PHP MySQL 扩展。在 Ubuntu 上,这将是:

sudo apt-get install php5-mysql

关于PHP 5.4.9 未定义的类常量 'MYSQL_ATTR_INIT_COMMAND',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20552686/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com