MYSQL working but not pdo : PDOException with msg SQLSTATE[HY000][2002]No such file or directory

Hello, [First, sorry for my english i from belgium]
i’m going to test the infinityfree platform.

With this code :
$db = new pdo(‘mysql: host=sql110.epizy.com;dbname=epiz_22041363_test1’,‘epiz_22041363’,‘’);

I have this error :
Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] No such file or directory’ in /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php:11 Stack trace: #0 /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php(11): PDO->__construct(‘mysql: host=sql…’, ‘epiz_22041363’, ‘dont look this’) #1 {main} thrown in /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php on line 11

If i try the same but with Mysql
$link = mysql_connect(‘sql110.epizy.com’, ‘epiz_22041363’, ‘PasswordOfTheFTP’);

It works. I want to use Pdo beacause it’s not deprecated and i know how to use it.
I’ve tried to change the php version used;

I think its the dbname for pdo but the db exists.

Thank you
Bye.

@Shwepps said:
Hello, [First, sorry for my english i from belgium]
i’m going to test the infinityfree platform.

With this code :
$db = new pdo(‘mysql: host=sql110.epizy.com;dbname=epiz_22041363_test1’,‘epiz_22041363’,‘’);

I have this error :
Fatal error: Uncaught exception ‘PDOException’ with message ‘SQLSTATE[HY000] [2002] No such file or directory’ in /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php:11 Stack trace: #0 /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php(11): PDO->__construct(‘mysql: host=sql…’, ‘epiz_22041363’, ‘dont look this’) #1 {main} thrown in /home/vol6_5/epizy.com/epiz_22041363/htdocs/index.php on line 11

If i try the same but with Mysql
$link = mysql_connect(‘sql110.epizy.com’, ‘epiz_22041363’, ‘PasswordOfTheFTP’);

It works. I want to use Pdo beacause it’s not deprecated and i know how to use it.
I’ve tried to change the php version used;

I think its the dbname for pdo but the db exists.

Thank you
Bye.

I don’t know about this but the only thing I know this is the code 2002 meaning it can’t connect to MySQL Database, so there might be something that breaks your connection or something

Thanks but that dont help me.

PDO dont works, mysql&mysqli works

I solved the problem: a space is too much in my request pdo

$db = new pdo('mysql: host…
-----------------------------------^ here

@Shwepps said:
I solved the problem: a space is too much in my request pdo

$db = new pdo('mysql: host…
-----------------------------------^ here
Do you want a number of tables ?