无法在App Engine上的PHP Flex Env中使用mysqli



我最近从标准env转换为flex env,以便我可以在PHP应用中使用插座。但是,现在我的mysqli函数在部署时不起作用...

这是函数和错误调用的样子...

    $link = new mysqli(
                    null,                                                   // host
                    'user',                                             // username
                    null,                                                       // password
                    'db',                                           // database name
                    null,
                    '/cloudsql/myapp:us-central1:sql-instance'      // instance name
                );

我想念什么吗?我可以在Flex Env中使用mysqli吗?这是错误日志...

    2017-06-22 21:40:16 admin[20170622t152917]  172.17.0.1 - - [22/Jun/2017:21:40:16 +0000] "GET / HTTP/1.1" 499 0 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
    2017-06-22 21:40:17 admin[20170622t152917]  "GET /" 499
    2017-06-22 21:40:21 admin[20170622t152917]  "POST /app/template_tabs.php" 499
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /MyAdmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /db/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /myadmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /mysql/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /mysqladmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /p/m/a/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /php-my-admin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.2.6/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.5.1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.5.5-rc2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.5.6-rc1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.5.6-rc2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.0-alpha/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.0-alpha2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.0-rc3/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.0/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.1-pl1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.1-pl3/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.2-beta1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.3/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.6.4-pl4/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.7.0-pl1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.7.0-rc1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.8.0-beta1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.8.0.3/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2.8.0/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin-2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpMyAdmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpadmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpmanager/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpmyadmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpmyadmin1/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /phpmyadmin2/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /pma2005/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /sqlweb/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /web/phpMyAdmin/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /web/scripts/setup.php" 404
    2017-06-22 21:40:29 admin[20170622t151722]  "GET /websql/scripts/setup.php" 404
    2017-06-22 21:41:11 admin[20170622t152917]  [22-Jun-2017 21:41:11] WARNING: [pool app] child 36 said into stderr: "NOTICE: PHP message: PHP Warning:  mysqli::__construct(): (HY000/2002): Connection timed out in /app/php/cons.php on line 25"
    2017-06-22 21:41:11 admin[20170622t152917]  [22-Jun-2017 21:41:11] WARNING: [pool app] child 36 said into stderr: "NOTICE: PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 4"
    2017-06-22 21:41:11 admin[20170622t152917]  [22-Jun-2017 21:41:11] WARNING: [pool app] child 36 said into stderr: "NOTICE: PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 7"
    2017-06-22 21:41:11 admin[20170622t152917]  [22-Jun-2017 21:41:11] WARNING: [pool app] child 36 said into stderr: "NOTICE: PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 26"
    2017-06-22 21:41:11 admin[20170622t152917]  [22-Jun-2017 21:41:11] WARNING: [pool app] child 36 said into stderr: "NOTICE: PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 59"
    2017-06-22 21:41:12 admin[20170622t152917]  [22-Jun-2017 21:41:12] WARNING: [pool app] child 37 said into stderr: "NOTICE: PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 4"
    2017-06-22 21:41:12 admin[20170622t152917]  [22-Jun-2017 21:41:12] WARNING: [pool app] child 37 said into stderr: "NOTICE: PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 7"
    2017-06-22 21:41:12 admin[20170622t152917]  [22-Jun-2017 21:41:12] WARNING: [pool app] child 37 said into stderr: "NOTICE: PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 26"
    2017-06-22 21:41:12 admin[20170622t152917]  [22-Jun-2017 21:41:12] WARNING: [pool app] child 37 said into stderr: "NOTICE: PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 59"
    2017-06-22 21:41:12 admin[20170622t152917]  PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 4
    2017-06-22 21:41:12 admin[20170622t152917]  PHP message: PHP Warning:  mysqli_query(): Couldn't fetch mysqli in /app/app/body.php on line 7
    2017-06-22 21:41:12 admin[20170622t152917]  PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 26
    2017-06-22 21:41:12 admin[20170622t152917]  172.17.0.1 - - [22/Jun/2017:21:41:12 +0000] "GET / HTTP/1.1" 200 2404 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
    2017-06-22 21:41:12 admin[20170622t152917]  PHP message: PHP Warning:  Invalid argument supplied for foreach() in /app/app/body.php on line 59" while reading response header from upstream, client: 172.17.0.1, server: , request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "admin-dot-appdocs-com.appspot.com"
    2017-06-22 21:41:17 admin[20170622t152917]  "GET /" 200
    2017-06-22 21:41:17 admin[20170622t152917]  "GET /favicon.ico" 200

添加文件 php.ini的以下内容:

mysqli.default_socket= '/cloudsql/CONNECTION_NAME' 

还确保启用了sqladmin API:https://console.cloud.google.com/apis/api/sqladmin.googleapis.com/overview

相关内容

  • 没有找到相关文章

最新更新