我只是部署以下应用。而且我收到错误。请帮我解决这个问题。
$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?
答案 0 :(得分:0)
socket argument没有说任何有关前缀的信息:
$socket_path = "/cloudsql/My_Project_ID:google-cloud-instance";
$c = new mysqli(null, "my-user", "my-password", 'my-db', $socket_path);