title: Sending REST Call to Google Cloud PHPMyAdmin Server not working?
body: <p>I have successfully deployed a <code>phpMyAdmin</code> server on <code>Google Cloud</code> by following this <a href="https://cloud.google.com/sql/docs/phpmyadmin-on-app-engine" rel="noreferrer">link</a>. I am having trouble trying to write to a database that I made in <em>phpMyAdmin</em>. I am trying to create a Notification Service based on the new <code>Firebase Cloud Messaging</code> that Google has released.</p>
  
  <p>NotificationInstanceService.java</p>
  
  <pre><code>public class NotificationInstanceService extends FirebaseInstanceIdService {
      private static final String TAG = "NotificationInstance";
  
      @Override
      public void onTokenRefresh() {
  
          //Getting registration token
          String refreshedToken = FirebaseInstanceId.getInstance().getToken();
  
          //Displaying token on logcat
          Log.d(TAG, "Refreshed token: " + refreshedToken);
  
          sendRegistrationToServer(refreshedToken);
  
      }
  
      private void sendRegistrationToServer(String token) {
          //You can implement this method to store the token on your server
          //Not required for current project
          OkHttpClient client = new OkHttpClient();
          //Create the request body
          RequestBody body = new FormBody.Builder().add("Token", token).build();
          //Know where to send the request to
          Request request = new Request.Builder().url("&lt;db link&gt;.appspot.com/fcm/register.php")
                  .post(body)
                  .build();
          //Create
          try {
              client.newCall(request).execute();
          } catch (IOException e) {
              e.printStackTrace();
          }
  
      }
  }
  </code></pre>
  
  <p>And I deployed, on <code>https://&lt;db link&gt;.appspot.com</code>, a file under /fcm/register.php which looks like so:</p>
  
  <p>register.php</p>
  
  <pre><code>&lt;?php
      if (isset($_POST["Token"])) {
  
             $_uv_Token=$_POST["Token"];
             $conn = mysqli_connect("&lt;db link&gt;.appspot.com","root","","fcm") or die("Error connecting");
             $q="INSERT INTO users (Token) VALUES ( '$_uv_Token') "
                ." ON DUPLICATE KEY UPDATE Token = '$_uv_Token';";
  
        mysqli_query($conn,$q) or die(mysqli_error($conn));
        mysqli_close($conn);
      }
   ?&gt;
  </code></pre>
  
  <p>I am confused because I don't seem to be writing anything to my database called users which I know I already created in the <code>MySQL</code> server created on <em>phpMyAdmin</em>. I know that the user name and password are also already set on <code>register.php.</code> Is there any way I can debug whether or not my script is actually going into the PHP code? How can I debug the PHP code? I also that the Request is actually being built as I can debug through that part of the code. Any help would be appreciated. Thanks!</p>
  
  <p>EDIT: Some files that may be helpful that I created when trying to deploy my server:</p>
  
  <p>app.yaml:</p>
  
  <pre><code>application: &lt;app server url&gt;
  service: default
  runtime: php55
  api_version: 1
  version: alpha-001
  
  handlers:
  
  - url: /(.+\.(ico|jpg|png|gif))$
    static_files: \1
    upload: (.+\.(ico|jpg|png|gif))$
    application_readable: true
  
  - url: /(.+\.(htm|html|css|js))$
    static_files: \1
    upload: (.+\.(htm|html|css|js))$
    application_readable: true
  
  - url: /(.+\.php)$
    script: \1
    login: admin
  
  - url: /.*
    script: index.php
    login: admin
  
  - url: /.*
    script: register.php
    login: admin
  </code></pre>
  
  <p>config.inc.php:</p>
  
  <pre><code>&lt;?php 
  $cfg['blowfish_secret'] = '&lt;Secret&gt;'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
  
  /*
   * Servers configuration
   */
  $i = 0;
  
  // Change this to use the project and instance that you've created.
  $host = '/cloudsql/&lt;app server url&gt;:us-central1:&lt;database name&gt;-app-php';
  $type = 'socket';
  
  /*
  * First server
  */
  $i++;
  /* Authentication type */
  $cfg['Servers'][$i]['auth_type'] = 'cookie';
  /* Server parameters */
  $cfg['Servers'][$i]['socket'] = $host;
  $cfg['Servers'][$i]['connect_type'] = $type;
  $cfg['Servers'][$i]['compress'] = false;
  /* Select mysql if your server does not have mysqli */
  $cfg['Servers'][$i]['extension'] = 'mysqli';
  $cfg['Servers'][$i]['AllowNoPassword'] = true;
  /*
   * End of servers configuration
   */
  
  /*
   * Directories for saving/loading files from server
   */
  $cfg['UploadDir'] = '';
  $cfg['SaveDir'] = '';
  
  $cfg['PmaNoRelation_DisableWarning'] = true;
  $cfg['ExecTimeLimit'] = 60;
  $cfg['CheckConfigurationPermissions'] = false;
  // [END all]
  </code></pre>
  
  <p>php.ini:</p>
  
  <pre><code>google_app_engine.enable_functions = "php_uname, getmypid"
  </code></pre>
  
  <p>EDIT: Text when in browser, going to .appspot.com/fcm/register.php</p>
  
  <blockquote>
    <p>array(11) { ["pmaCookieVer"]=> string(1) "5" ["pma_lang"]=> string(2)
    "en" ["pma_collation_connection"]=> string(15) "utf8_unicode_ci"
    ["pma_console_height"]=> string(2) "92" ["SACSID"]=> string(355)
    "~AJKiYcFgym76QZfbMX35ddCTdKKf-O7q5koLvNZ0coWTMvw9aNlR5fusNyLRzFyw5DB_t2ygVuTEjHwgrgBco4-wr_V3Eer_Mf0CDuGX2e4IpirCNeiGxkRvaLgRPPyZNZWKUx1mF_DChjsksTirkY5WCzlA3G3MO9bBScrLw8kNOFGnvzkev3-B2x31s_TmnDN5aJ0G3-nPueI4FPpKaaMlPsITziccvXMpiehglQOKoo1Bol3EZSF1tjI9QoJuc-6X_sHgJ0IEppg7K-cBapaEx5CmDD2kWOggnVPWnGj1SiKFUnE3DZD46bjovf5me7IdwfVX22bv5D2PJDPQEN4m3D7yP3-Wdg"
    ["pma_console_config"]=> string(103)
    "{"alwaysExpand":false,"startHistory":false,"currentQuery":true,"enterExecutes":false,"darkTheme":false}"
    ["pma_console_mode"]=> string(4) "show" ["phpMyAdmin"]=> string(40)
    "cfd814e10982d138c7ed4a3ef510c454c0e5f9b9" ["pma_iv-1"]=> string(24)
    "bSPnJOOBe5x0iXPbbU5Nww==" ["pmaUser-1"]=> string(24)
    "oHSLKZ7q6eOaXJ475Q6tzw==" ["pmaPass-1"]=> string(24)
    "dwKZ9gQPCoe/Uk4sWS4s2g==" }</p>
  </blockquote>
  
  <p>new register.php:</p>
  
  <pre><code>&lt;?php
      if (isset($_REQUEST["Token"])) {
  
             $_uv_Token=$_REQUEST["Token"];
             $conn = mysqli_connect("/cloudsql/&lt;Database ServerURL&gt;","root","","FCM") or die("Error connecting");
             $q="INSERT INTO users (Token) VALUES ( '$_uv_Token') "
                ." ON DUPLICATE KEY UPDATE Token = '$_uv_Token';";
        var_dump(mysqli_query($conn,$q));
        mysqli_query($conn,$q) or die(mysqli_error($conn));
        mysqli_close($conn);
      } else {
          var_dump($_REQUEST);
      }
   ?&gt;
  </code></pre>
  
  <p>NotificationInstanceService.java</p>
  
  <p>New POST Request:</p>
  
  <pre><code>    Request request = new Request.Builder().url("&lt;Application Server&gt;/fcm/register.php?Token=123")
              .post(body)
              .build();
  </code></pre>