将远程mysql数据库连接到App引擎时出错

时间:2014-04-18 14:39:47

标签: mysql database google-app-engine

我有一个远程mysql数据库,我想将它连接到我在谷歌应用引擎中的应用程序,但我有这些错误:

No pudo conectarse: php_network_getaddresses: gethostbyname failed. errno=0

这些是文件:

的config.php:

<?php 
    $host_db = "<myhost>";
    $usuario_db = "<myuser>"; 
    $clave_db = "<mypass>"; 
    $nombre_db = "<namedatabase>";
    date_default_timezone_set("Europe/Berlin");

    //conectamos y seleccionamos db 
    $enlace = mysql_connect($host_db, $usuario_db, $clave_db); 
    if (!$enlace) {
      die('No pudo conectarse: ' . mysql_error());
    }
    mysql_select_db($nombre_db); 
    mysql_query("SET NAMES utf8mb4");
    mysql_query("SET CHARACTER SET utf8mb4");
?>

apiv1 / connect / login.php(https://argon-producer-554.appspot.com/apiv1/connect/login.php?user=test&passmd5=202cb962ac59075b964b07152d234b70):

<?php 
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');  
session_start(); 
include('../../config.php'); 
[...]
Line 15 => mysql_query()
[...]
?>

PD:应用引擎版本为1.9.3

0 个答案:

没有答案