title: Cannot connect to a MYSQL instance from my Laravel 5.5 app both in the same GCloud project
body: <p>I'm trying to connect to my database stored in GCloud from a PHP Laravel 5.5 app in the same Gcloud project.</p>
  
  <p>When I deploy my app, the homepage is displayed well but, when I try to connect the user, I get these errors that show on the browser: </p>
  
  <p><a href="https://i.stack.imgur.com/LTBqI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LTBqI.jpg" alt="PDOException"></a>
  <a href="https://i.stack.imgur.com/cCYQI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/cCYQI.jpg" alt="QueryException"></a></p>
  
  <p>I followed this tutorial: <a href="https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible" rel="nofollow noreferrer">Run Laravel on Google App Engine Flexible Environment</a></p>
  
  <p>My app.yaml file looks like this:</p>
  
  <pre><code>runtime: php
  env: flex
  
  runtime_config:
  document_root: public
  
  skip_files:
   - .env
  
  env_variables:
    APP_LOG: errorlog
    APP_DEBUG: true
    APP_KEY: MY-APP-KEY
    STORAGE_DIR: /tmp
    CACHE_DRIVER: file
    SESSION_DRIVER: file
    DB_CONNECTION : mysql
    DB_HOST: localhost
    DB_PORT: 3306
    DB_DATABASE: MY DB NAME
    DB_USERNAME: USERNAME
    DB_PASSWORD: PASSWORD
    DB_SOCKET: "/cloudsql/MY-PROJECT-NAME:us-central1:MY-SQL-INSTANCE-NAME"
  </code></pre>
  
  <p>In the tutorial, they said to put this:</p>
  
  <pre><code>beta_settings:
      # for Cloud SQL, set this value to the Cloud SQL connection name,
      # e.g. "project:region:cloudsql-instance"
      cloud_sql_instances: "YOUR_CLOUDSQL_CONNECTION_NAME"
  </code></pre>
  
  <p>But I removed it beacause when I run the command <strong>gcloud app deploy</strong>, I get this error: <strong>An error occurred while parsing file : app.yaml at line xx column xx</strong></p>
  
  <p>In my <strong>database.php</strong> file, I've tryed this:</p>
  
  <pre><code>'mysql' =&gt; [
              'driver' =&gt; 'mysql',
              'host' =&gt; 'localhost',
              'port' =&gt; '3306',
              'database' =&gt; 'DBNAME',
              'username' =&gt; 'USERNAME',
              'password' =&gt; 'PASWORD',
              'unix_socket' =&gt; env('DB_SOCKET', ''),
              'charset' =&gt; 'utf8',
              'collation' =&gt; 'utf8_unicode_ci',
              'prefix' =&gt; '',
              'strict' =&gt; false,
              'engine' =&gt; null,
          ]
  </code></pre>
  
  <p>And this (providing <strong>unix_socket</strong>): </p>
  
  <pre><code>'mysql' =&gt; [
              'driver' =&gt; 'mysql',
              'host' =&gt; 'localhost',
              'port' =&gt; '3306',
              'database' =&gt; 'DBNAME',
              'username' =&gt; 'USERNAME',
              'password' =&gt; 'PASSWORD',
              'unix_socket' =&gt; env('DB_SOCKET', '/cloudsql/MY-PROJECT-NAME:us-central1:MY-SQL-INSTANCE-NAME'),
              'charset' =&gt; 'utf8',
              'collation' =&gt; 'utf8_unicode_ci',
              'prefix' =&gt; '',
              'strict' =&gt; false,
              'engine' =&gt; null,
          ]
  </code></pre>
  
  <p>PLEASE NOTE THAT:</p>
  
  <ol>
  <li>My API is enabled.</li>
  <li>Billing is enabled.</li>
  </ol>