EC2 + PHP + MySQL = Headache

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
markclancy
Forum Newbie
Posts: 1
Joined: Tue Jun 01, 2010 12:18 am

EC2 + PHP + MySQL = Headache

Post by markclancy »

I'm stumped and looking for some new ideas on an issue.

I'm using Amazon EC2 with WAMP (Windows/Apache2.2/PHP5.2.9/MySQL5.1). I have a very simple PHP routine to select some data from a database (see below -- identical code with just username/password changed).

When run from a browser, this returns a blank page with "Internet Explorer Cannot Display Webpage".

What's strange is that it works fine when I execute the PHP from the command line. I can also execute any other PHP script without a problem as long as it doesn't try to connect to MySQL. I've also successfully run the PHP through the browser on a non-EC2 box.

I've also turned on all logging I can think of --- Apache, PHP, MySQL -- and nothing appears in the logs. As well, I've set the AWS console to allow MySQL but not sure that's even relevant.

Any help would be greatly appreciated

Thanks!!

Mark



Code: Select all

<?php 
$con = mysql_connect("localhost","username","password"); 
if (!$con) 
  { 
  die('Could not connect: ' . mysql_error()); 
  } 

mysql_select_db("tvan_processing", $con); 

$result = mysql_query("SELECT * FROM tbl_vd_regiontoarea"); 

while($row = mysql_fetch_array($result)) 
  { 
  echo $row['Region'] . " " . $row['Area']; 
  echo "<br />"; 
  } 

mysql_close($con); 
?>
Last edited by Benjamin on Tue Jun 01, 2010 12:29 am, edited 1 time in total.
Reason: Added [syntax=php] tags.
Post Reply