Zend Framework: Undefined class constant 'MYSQ

2019-05-29 01:04发布

As you may have known that I switched from ubuntu to windows from my previous questions. I was working on Zend Framework on ubuntu and now working on same project in windows. Because of this switching I am facing some problems in windows which was not occurred in ubuntu.

Now I have the following error in firebug console when I go to login page:

<b>Fatal error</b>:  Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in <b>C:\wamp\www\vcred\library\Zend\Db\Adapter\Pdo\Mysql.php</b> on line <b>93</b><br />

Do you people know that what type of error is this and what is the solution?

I have the following configuration for database.

resources.db.adapter = "Pdo_Mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = ""
resources.db.params.dbname = "test"
resources.db.params.charset = "utf8"

Thanks

4条回答
Deceive 欺骗
2楼-- · 2019-05-29 01:28

I got the same error, on debian6, when I had not yet installed php-mysql so, I simply installed this, like this

apt-get install php5-mysql
/etc/init.d/apache2 restart

I just add it here, in case other have same problem, to save them them a few minutes of research.

查看更多
走好不送
3楼-- · 2019-05-29 01:32

Looks like a Windows bug in PHP 5.3 that was fixed in SVN a while ago. You might want to try updating to the latest PHP release to see if the issue still exists.

查看更多
爷、活的狠高调
4楼-- · 2019-05-29 01:36

I just had the same error with PHP 5.2.6, and all I had to do is to open php.ini (e.g. on Windows: C:\Windows\php.ini, or on Ubuntu: /etc/php5/apache2/php.ini or sg. like this) in a text editor, and remove the semicolon from the following line:

;extension=php_pdo_mysql.dll

So as a result it would look like this in php.ini:

extension=php_pdo_mysql.dll

That solved my problem.

查看更多
爱情/是我丢掉的垃圾
5楼-- · 2019-05-29 01:45

This looks related to this bug on PHP's bugtracker : Bug #47224 MYSQL_ATTR_INIT_COMMAND is no longer available

It seems it's been fixed in SVN -- but maybe not in the version of PHP you are using ?


Quoting one of the comments :

[2009-07-02 06:43 UTC] mg at artigo dot pl
A temporary solution is to use INT value (1002) instead of constant.

This might be a temporary solution, until you install a new version of PHP, in which the bug is fixed ?

查看更多
登录 后发表回答