• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Can't migrate Laravel website - QueryException: SQLSTATE[HY000] [2002] Connection refused

gene123

New Pleskian
Hi there, I can't migrate existing Laravel website from old Plesk to new Plesk Obsidian, OS: CentOS Linux 7.9.2009 (Core). When I go to login page and click "Login" I'm getting QueryException: SQLSTATE[HY000] [2002] Connection refused (SQL: select * from `users` where `email` = ....). The new database with username/password was created. I specified it in .env file as well as in config/database.php.
Also when I ssh into this server and run command: >php artisan config:cache
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /var/www/vhosts/<my domain>/artisan on line 33
>php -v gives: PHP 5.4.16 (cli) (built: Apr 1 2020 04:07:17)
although in plesk domain PHP version: 7.3.27
What could be the issue here? Thanks.
 
Last edited:
Besides username and password there are host name and port. Is the host set to localhost or 127.0.0.1 and the port set to 3306 (normally)?
 
When running PHP in command line the default PHP version from the OS will be used. Which in case of CentOS 7.9 will be 5.4. Instead you can run /opt/plesk/php/7.3/bin/php -f artisan config:cache to utilize the PHP 7.3 version offered by Plesk.

Not sure if that solves your issue, but it might helps you to find a solution to your database issue.
 
Back
Top