简体   繁体   English

EasyApache更新后mysql_connect无法正常工作

[英]mysql_connect not working after EasyApache update

I am running out of ideas here and hoping someone can help me out. 我在这里没有任何想法,希望有人可以帮助我。

I am using WHM, and used the EasyApache to enable zip. 我正在使用WHM,并使用EasyApache启用zip。 Upon completion all my mysql_connect statements stopped working. 完成后,我所有的mysql_connect语句停止工作。

So running a basic piece of code like: 因此,运行一段基本的代码,例如:

<?php

$link = mysql_connect('localhost', 'usrhere', 'passhere');

if (!$link) {
    die('Could not connect: ' . mysql_error());
}

echo 'Connected successfully';

mysql_close($link);

?>

Returns: "Could not connect: Access denied for user 'cpaneluser'@'localhost' (using password: NO)". 返回:“无法连接:用户'cpaneluser'@'localhost'的访问被拒绝(使用密码:否)”。 So you'll notice the username and password here are being ignored. 因此,您会注意到此处的用户名和密码已被忽略。 Am I missing an extension or library or something? 我是否缺少扩展名或库或其他内容?

The strange thing is I am also running Zend Framework2, and this has no problem connecting to the DB with the default code. 奇怪的是我也正在运行Zend Framework2,并且使用默认代码连接到数据库没有问题。

If this happens to anyone else, for some reason when doing EasyApache it put me in sql safe mode. 如果其他任何人都遇到了这种情况,则在执行EasyApache时由于某种原因会将其置于sql安全模式。 Changing that to off in my php.ini resolved everything. 在我的php.ini中将其更改为off可以解决所有问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM