facebook / facebook/hhvm

None of the `mysql` `*socket` INI settings work

Open
#7,151 0 comments 1 reaction 0 assignees View on GitHub
mid-pri
Dominant language
C++
Stars
18.7k
Forks
3.1k
Avg merge
1h 47m
Merged PRs (30d)
2

Description

### HHVM Version

3.12.1 LTS
### Standalone code, or other way to reproduce the problem

I think that with the code in the docs example, the problem appears (my code uses `AsyncMysqlClient`) so there should be the same thing.

``` hack
{
// Cast because the array from get_connection_info() is a mixed
$conn = await \AsyncMysqlClient::connect(
CI::$host,
CI::$port,
CI::$db,
CI::$user,
CI::$passwd);
return await $conn->query('SELECT * FROM test_table');
}

function run_it(): void {
$res = \HH\Asio\join(do_connect());
var_dump($res->numRows()); // The number of rows from the SELECT statement
}

run_it();
```

Info about the MySQL server below.

``` bash
$ mysql --version
mysql Ver 14.14 Distrib 5.6.30, for debian-linux-gnu (x86_64) using EditLine wrapper
```

The `my.cnf` configuration file sets the socket of `[mysqld]`, `[client]` and all other available groups to `/var/run/mysqld/mysqld.sock`.
### Expected result

Working MySQL connection.
### Actual result

Exception with the message

```
Error executing AsyncMysql operation: Failed (mysql error: 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2))
```
### What have I tried?

I tried setting the following options both in `server.ini` and `php.ini` successively and the same exception kept appearing. I solved in on my dev machine by changing the MySQL server socket location to the one that HHVM wants, but I don't want to change it as well on the production server.

``` ini
hhvm.mysql.socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.