php - Can't connect MySQL after deploying app on AppEngine -


can me fix , wrote simple code test mysql connection , work on locally can't connect mysql after deployed on app engine.

file app.yaml:

application: testmysql07  version: 1  runtime: php55  api_version: 1  threadsafe: yes  handlers:  - url: /favicon\.ico   static_files: favicon.ico   upload: favicon\.ico  - url: .*   script: main.php 

file main.php:

<?php  $hostname     = "localhost";   $username     = "root";  $password     = "";  $databasename = "web_bb";   $conn = mysql_connect($hostname,$username,$password,$databasename) or die("can't connect mysql");      echo "successful </br>";  mysql_select_db($databasename,$conn);  ?> 

sorry i'm not in speaking english

to connect local mysql database during development, you'll need

  1. enable billing app. allows use sockets connect remote servers.
  2. make sure local mysql database reachable internet, i.e. having correct firewall/nat settings in router.
  3. use public ip address $hostname in code.

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -