title: SQL error 'No such file or directory' when connecting from Laravel PHP in AppEngine
body: <p>We have tried almost every solution we could find on Stackoverflow but are still getting this error.</p>
  <p>We are using Google Cloud SQL with our Laravel project. We have deployed our project in app engine and are using cloud SQL for database connection. We followed <a href="https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible" rel="nofollow noreferrer">this</a> for deployment, but after deployment we are unable to connect with the database and getting the error:</p>
  <blockquote>
  <p>SQLSTATE[HY000] [2002] No such file or directory.</p>
  <p>SQLSTATE[HY000] [2002] No such file or directory (SQL: select * from <code>sessions</code> where <code>id</code> = dbzqd19nOIbfwWndCLAbNYXThlIge96OM3t9MjDu limit 1)</p>
  </blockquote>
  <p>We can establish connection with public instance IP and in our local development it is working, but when we deploy the code on app engine we are getting this issue.</p>
  <p>App.yaml file configuration:</p>
  <pre><code>runtime: php
  api_version: '1.0'
  env: flexible
  threadsafe: true
  env_variables:
    APP_DEBUG: 'True'
    APP_KEY: '&lt;APP KEY HERE&gt;'
    APP_LOG: errorlog
    APP_NAME: &lt;APP NAME HERE&gt;
    beta_settings: None
    CACHE_DRIVER: database
    cloud_sql_instances: '&lt;project-id-here&gt;:&lt;region-here&gt;:&lt;name here&gt;'
    DB_DATABASE: &lt;name here&gt;
    DB_HOST: 127.0.0.1 or localhost (neither work)
    DB_PASSWORD: &lt;PASSWORD HERE&gt; (also leaving empty doesn't work)
    DB_SOCKET: /mysql/mysql.sock
    DB_USERNAME: root
    SESSION_DRIVER: database
    STORAGE_DIR: /tmp
  automatic_scaling:
    min_num_instances: 2
    max_num_instances: 20
    cpu_utilization:
      target_utilization: 0.5
  </code></pre>