title: Google Cloud SQL: Error while reading greeting packet
body: <p>I am new to Google App Engine. I am currently following the tutorial for Google App Engine here: <a href="https://cloud.google.com/appengine/docs/php/cloud-sql/" rel="nofollow">https://cloud.google.com/appengine/docs/php/cloud-sql/</a></p>
  
  <p>I can't seem to get my application to access the Cloud-SQL database on Google App Engine.</p>
  
  <p>I keep receiving this error below:</p>
  
  <pre><code>Warning: PDO::__construct(): MySQL server has gone away in /base/data/home/apps/p~iconic-indexer-112318/1.388447661471940227/guestbook.php on line 24 
  Warning: PDO::__construct(): Error while reading greeting packet. PID=-1 in /base/data/home/apps/p~iconic-indexer-112318/1.388447661471940227/guestbook.php on line 24 {"outcome":false,"message":"Unable to connect."}
  </code></pre>
  
  <p>I have looked at other questions that point to a syntax error, but I'm not quite sure I see one here. I believe my application has access to the Cloud-SQL database. Because I have created the database instances inside of my application and according to this link: <a href="https://cloud.google.com/appengine/docs/php/cloud-sql/#create" rel="nofollow">https://cloud.google.com/appengine/docs/php/cloud-sql/#create</a></p>
  
  <p>My application should have access to the database.
  Aside from this I have no other Authorized App Engine Applications and even if I did try to add iconic-indexer-112318, it doesn't allow me to and notifies me "Could not complete the operation". I suspect this is because the application already has access.</p>
  
  <p>I have doubled checked and both the application and instances are in the same region : us-east1</p>
  
  <p>Project Id: iconic-indexer-112318</p>
  
  <p>Instance Id: iconic-indexer-112318:hellodb</p>
  
  <pre><code> // Connect from App Engine.
   try{
      $db = new pdo('mysql:unix_socket=/cloudsql/iconic-indexer-112318:iconic-indexer-112318:hellodb;dbname=guestbook', 'root', '');
   }catch(PDOException $ex){
       die(json_encode(
           array('outcome' =&gt; false, 'message' =&gt; 'Unable to connect.')
           )
       );
   }
  </code></pre>
  
  <p>I am not sure what is wrong. Thank you for your assistance.</p>