You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Co\run(function() {
go(function () {
$pool = new MysqliPool(
(new MysqliConfig())
->withHost('hackathon-mysql-8')
->withPort(3306)
// ->withUnixSocket('/tmp/mysql.sock')
->withDbName('myDB')
->withCharset('utf8mb4')
->withUsername('root')
->withPassword('XXX')
);
$conn = $pool->get();
echo "got MySQL connection";
});
});
and it results in this runtime error:
Warning: mysqli::real_connect(): (HY000/2002): DNS Lookup resolve failed in @swoole-src/library/core/Database/MysqliPool.php on line 40
Fatal error: Uncaught Swoole\Database\MysqliException: DNS Lookup resolve failed in @swoole-src/library/core/Database/MysqliPool.php:43
Stack trace:
#0 @swoole-src/library/core/Database/MysqliProxy.php(46): Swoole\Database\MysqliPool->Swoole\Database\{closure}()
#1 @swoole-src/library/core/ConnectionPool.php(89): Swoole\Database\MysqliProxy->__construct(Object(Closure))
#2 @swoole-src/library/core/ConnectionPool.php(58): Swoole\ConnectionPool->make()
#3 /app/server.php(27): Swoole\ConnectionPool->get()
#4 {main}
thrown in @swoole-src/library/core/Database/MysqliPool.php on line 43
terminate called after throwing an instance of 'std::bad_function_call'
what(): bad_function_call
our container is joined to the default bridge network. How can we fix this error?
We are using 4.5.9 of Swoole and php:8.0-cli Docker image.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
we are new to Swoole. This is our code:
and it results in this runtime error:
our container is joined to the default
bridge
network. How can we fix this error?We are using 4.5.9 of Swoole and
php:8.0-cli
Docker image.Beta Was this translation helpful? Give feedback.
All reactions