title: Can not connect AWS RDS using PHP file hosted online (GoDaddy)
body: <p>I do not believe the question to be a duplicate as I believe the issue is related to Shared Hosting environments getting outbound to other cloud mysql servers.</p>
  
  <p>Error message</p>
  
  <blockquote>
    <p>PDO Exception: SQLSTATE[HY000] [2002] Connection timed out.</p>
  </blockquote>
  
  <p>I am simply just trying to connect to my instance of AWS RDS and run a query on one of my tables.</p>
  
  <p>SOLUTION: GODADDY BLOCKS ALL PORTS EXCEPT 21 AND 22 (FTP) ON A STANDARD ACCOUNT. THIS IS WHAT I WAS TOLD BY GODADDY TECHNICAL SUPPORT. HENCE, IT WILL BLOCK PORT 1234 AND EVEN 3306 FOR A DATABASE CONNECTION.</p>
  
  <p>UPDATE:</p>
  
  <p>@Drew has validated that this php code works for the connection:</p>
  
  <pre><code>try {
          $db = new PDO('mysql:host=uwmparkingbackend.cb7gmuw49vhs.us-east-1.rds.amazonaws.com;port=1234;dbname=uwm_parking;charset=utf8', 'fbgrecojr', 'test1234');
          $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
          $db-&gt;setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
  
          echo "Connected and Happy&lt;br&gt;";
          $sql="select id,thing from thingsCoveted where id in (1,3)";
          foreach ($db-&gt;query($sql) as $row) {
              print $row['id'] . "\t";
              print $row['thing'] . "&lt;br&gt;";
          }
  
      } catch (PDOException $e) {
          echo 'PDO Exception: ' . $e-&gt;getMessage();
          exit();
      }
  </code></pre>
  
  <p>I am getting this error however on my end:</p>
  
  <pre><code>PDO Exception: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'uwmparkingbackend.cb7gmuw49vhs.us-east-1.rds.amazonaws.com' (110)
  </code></pre>
  
  <p>Hence, there is either a config issue on the Godaddy side (where the .php is hosted) or the AWS RDS side (where the database is hosted);</p>
  
  <p>Things I have tried:
  1) checked to make sure all PDO options are selected in GoDaddy's php settings
  2) added an inbound rule for my AWS RDS security group to allow all connections using my port (1234).</p>