I amm also facing the same issue

app.yaml

env: flex
runtime: php
runtime_config:
  document_root: .
env_variables:
  # Replace project, instance, database, user and password with the values 
obtained
  # when configuring your Cloud SQL instance.
  MYSQL_DSN: mysql:unix_socket=/cloudsqlxxxxxxxxxxxxxxxxxxx;dbname=testdb

  MYSQL_USER: root
  MYSQL_PASSWORD: xxxxxxxxxxxxxx
  MYSQL_DATABASE : testdb
w
beta_settings:
  cloud_sql_instances: "xxxxxxxxxxxxxx"


code sample

$dsn = getenv('MYSQL_DSN');
        $username = getenv('MYSQL_USER');
        $password = getenv('MYSQL_PASSWORD');
        $options = array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
        ); 
        try{
            $dbh = new PDO($dsn, $username, $password, $options);
            echo "conneced";exit;
        }catch(Exception $e) {
            print $e->getMessage();exit;
        }

On Friday, 30 September 2016 03:41:22 UTC+5:30, Kevin Lau wrote:
>
>
> down votefavorite 
> <http://stackoverflow.com/questions/39778544/why-does-my-php-app-engine-not-connect-to-cloud-sql#>
>
> I am trying to connect my app engine PHP app to cloud sql via unix socket 
> (I assume that is correct so that I don't have to connect to the ip). The 
> connect via IP works but the unix socket does not. Any ideas? It's also 
> weird that when I ssh into the box, I don't see any /cloudsql/ directory. I 
> can create it by manually starting cloud_sql_proxy but that doesn't persist 
> as soon as I turn debug off.
>
>
> I'm using: $db = new pdo( 
> 'mysql:unix_socket=/cloudsql/testproject-xxxxxx:us-central1:library;dbname=books',
>  
> 'phpapp', // username 'somepw' // password );
>
> And get SQLSTATE[HY000] [2002] No such file or directory
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/cd70cbcf-c973-4c32-b54d-06e00aabbf56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to