I've been using phpdao2.6 on a local Mac MAMP installation and another remote red hat linux server fine. I've recently moved to an EC2 amazon ubuntu flavour and installed a LAMP set up.
Suddenly I've found I'm getting mysql connection errors, but not always:
[09-Jul-2013 21:09:11 Australia/Sydney] PHP Warning: mysql_real_escape_string(): Access denied for user 'ec2-user'@'localhost' (using password: NO) in /var/www/html/mycobber/class/sql/SqlQuery.class.php on line 40
[09-Jul-2013 21:09:11 Australia/Sydney] PHP Warning: mysql_real_escape_string(): A link to the server could not be established in /var/www/html/mycobber/class/sql/SqlQuery.class.php on line 40
I only get these errors on functions in the MyObjectMySqlExtDAO.class.php if I'm using the
$sql .= 'and ca.enabled = ? ';
.....
$sqlQuery = new SqlQuery($sql);
$sqlQuery -> set('Y');
style syntax. If I change this syntax to ..
$sql .= " and ca.enabled = 'Y' ";
It works fine. I'm at a loss to understand why this is happening and I don't want to use the second method as the input is not sanitized.
I suspect the issue is a php setting of some kind.
On the EC2 instance I'm using:
php: 5.3.26
apache: Apache/2.2.24 (Amazon)
My local MAMP setup is
php: 5.4.10
apache: Apache/2.2.23 (Unix)
Any ideas out there?