Daniel Hollands Daniel Hollands - 2 years ago 191
PHP Question

PDOException SQLSTATE[HY000] [2002] No such file or directory

I believe that I've successfully deployed my (very basic) site to fortrabbit, but as soon as I connect to SSH to run some commands (such as

php artisan migrate
php artisan db:seed
) I get an error message:

SQLSTATE[HY000] [2002] No such file or directory

At some point the migration must have worked, because my tables are there - but this doesn't explain why it isn't working for me now.

Answer Source

The error message indicates that a MySQL connection via socket is tried (which is not supported).

In the context of Laravel (artisan), you probably want to use a different / the correct environment. Eg: php artisan migrate --env=production (or whatever environment). See here.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download