read file in php and insert into ec2 amazon server mysql database
<p>actually im having list of medicine in a file and i want to insert it on ec2 amazon server database which is mysql.I run this file on localhost.when im trying my code, which is in php it show an error as follows:im not getting.</p>

<p>Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com' (10060) in C:\websites\medicine\filehandling.php on line 17
Can't connect to MySQL
This is a servername:ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com
here is my code... and let me know where im wrong.</p>

<pre><code>&lt;?php

$hostname='http://ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com';
//$port='3306';
$user='root';//// specify username
$pass='bitnami'; //// specify password
$dbase='fortis'; //// specify database name
set_time_limit(1000);
$connection = mysql_connect("$hostname" , "$user" , "$pass" ,"$port") 
or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
$file = fopen("med4","r") or exit ("File not found");
$c =0 ;
      while (!feof($file)){
            ++$c;
        $val = fgets($file);
        mysql_query("insert into patientinfo_medicines (medicine) values ('$val')");    
      }
fclose($file);
echo $c;
?&gt;
</code></pre>
