无法使用 PHP Google App Engine 连接云 SQL



我只是部署以下应用程序。我收到错误。请帮我解决这个问题。

$instance_name = "mysql:unix_socket=/cloudsql/My_Project_ID:google-cloud-instance";
$c = new mysqli(null, "root", "My_Password", 'My_DB_Name', 0, $instance_name);
if ($c->connect_error) {
echo $c->connect_error;
$c = null;
} else {    
echo "Connected ";
}

我在浏览器中收到错误,例如

Unable to find the socket transport "unix" - did you forget to enable it when you configured PHP?

socket 参数没有说明前缀:

$socket_path = "/cloudsql/My_Project_ID:google-cloud-instance";
$c = new mysqli(null, "my-user", "my-password", 'my-db', $socket_path);

相关内容

  • 没有找到相关文章

最新更新