I have a very strange problem:
After deploying a small app to the prod server I am getting the following error:
Fatal error: Uncaught exception 'PDOException' with message 'Could not connect to database.' in D:\inetpub\vhosts\DOMAIN\httpdocs\app\db\rb.php:194
Stack trace:
#0 D:\inetpub\vhosts\DOMAIN\httpdocs\app\db\rb.php(338): RedBean_Driver_PDO->connect()
#1 D:\inetpub\vhosts\DOMAIN\httpdocs\app\db\rb.php(5674): RedBean_Driver_PDO->setDebugMode(true, Object(RedBean_Logger_Default))
#2 D:\inetpub\vhosts\DOMAIN\httpdocs\app\db\test.php(7): RedBean_Facade::debug(true)
#3 {main} thrown inD:\inetpub\vhosts\DOMAIN\httpdocs\app\db\rb.php on line 194
I double checked host, user, db name and password and everything looks good.
I even created 2 php scripts:
//this one throws the error
require('rb.php');
R::setup('mysql:host=localhost;dbname=DBNAME', 'DBUSER','DBPASS'); //mysql
R::debug(true);
$testRecord = R::load('test', 1);
echo $testRecord->name;
//this one works fine
mysql_connect('localhost', 'DBUSER', 'DBPASS') or die(mysql_error());
mysql_select_db('DBNAME') or die(mysql_error());
$result = mysql_query("SELECT * FROM test")
or die(mysql_error());
$row = mysql_fetch_array( $result );
echo "Name: ".$row['name'];
what am I missing here? Please note that both scripts work fine on localhost. Also, localhost in a Linux machine while PROD is Windows. But why would that matter?