Could not connect to amazon my sql rds using php -


i connecting amazon rds make web services using php not connect servers here code

<?php  try{ $dbhost = 'myrds.cjahuqpumuov.us-east-1.rds.amazonaws.com:3306'; $username = 'myname'; $password = 'mypassword'; $dbname = 'mydb';  $link = mysql_connect($dbhost, $username, $password, $dbname); mysql_select_db($dbname);  }  catch(exception e){  echo e  } ?> 

parse error: syntax error, unexpected t_string, expecting t_variable in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/selecttest.php on line 17

error trace

 warning: mysql_connect() [function.mysql-connect]: lost connection mysql server @ 'reading initial communication packet', system error: 110 in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/selecttest.php on line 12   warning: mysql_select_db() [function.mysql-select-db]: can't connect local mysql server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/selecttest.php on line 13   warning: mysql_select_db() [function.mysql-select-db]: link server not established in /home/content/i/h/u/ihus235/html/cs/pah_brd_v1/productivo/selecttest.php on line 13 

i think host name port number not allowing connect.. try removing port number :

$dbhost = 'myrds.cjahuqpumuov.us-east-1.rds.amazonaws.com';  

i faced same problem few days before.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -