I have put PushChatServer dir in htdocs folder and create database puschat try to run @\"http://localhost/PushChatServer/api/test/database.php\"
Then I got following
You need to change host from localhost to 127.0.0.1
localhost
127.0.0.1
Laravel 4: In your app/config/database.php try changing host from localhost to 127.0.0.1
app/config/database.php
Laravel 5: In the .env file, change DB_HOST from localhost to 127.0.0.1
.env
DB_HOST
Source: PDOException SQLSTATE[HY000] [2002] No such file or directory