Playing with Openshift origin 3.9 on my custom servers. So far it has been a pleasant experience. I've been building a custom s2i image based on Ubuntu for my LEMP stack.
I'm not able to connect to the MySQL database. I always get an error saying:
Failed to connect to MySQL: (2002) No such file or directory
Here's my PHP code:
$mysql_database = getenv("MYSQL_DATABASE");
$mysql_server_name =getenv("MYSQL_HOST");
$mysql_username = getenv("MYSQL_USER");
$mysql_password = getenv("MYSQL_PASSWORD");
$mysql_port = getenv("MYSQL_PORT");
$mysqli = new mysqli($mysql_server_name, $mysql_username, $mysql_password, $mysql_database, $mysql_port);
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
die();
}
Some observations:
I'm able to connect from MySQL CLI client from inside the pod.
The same app/code works fine with the official openshift PHP s2i image.
Am I missing anything in my s2i?
