0

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. Upon completion all my mysql_connect statements stopped working.

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)". 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.

Kyle
  • 164
  • 13
  • 2
    If you can, you should [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared](http://en.wikipedia.org/wiki/Prepared_statement) [statements](http://php.net/manual/en/pdo.prepared-statements.php) instead, and consider using PDO, [it's really not hard](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard Jun 24 '15 at 17:56
  • You're not missing anything, you just have not granted the proper access to that user. – Jay Blanchard Jun 24 '15 at 17:57
  • Thanks @JayBlanchard. I will definitely make the switch, but this is a little more urgent then that. Also, in regards to proper access. I can easily login and do everything in phpmyadmin with the same credentials. If you look at what I describe under the code, it is just ignoring the username and password I provide and trying to connect with the cpanel account name and no password. – Kyle Jun 24 '15 at 17:59
  • Code generally does not "ignore" anything. There has to be some other factor at play. – Jay Blanchard Jun 24 '15 at 18:02
  • I agree. That's exactly why I think I'm missing some sort of extension or core php code is not enabled. – Kyle Jun 24 '15 at 18:05

1 Answers1

0

If this happens to anyone else, for some reason when doing EasyApache it put me in sql safe mode. Changing that to off in my php.ini resolved everything.

Kyle
  • 164
  • 13