简体   繁体   English

Laravel PHP Artisan迁移连接被拒绝

[英]Laravel php artisan migrate connection refused

I am running Laravel 5 with PHP 7.0.6. 我正在使用PHP 7.0.6运行Laravel 5。 When I run the php artisan update command, I get the following error: 当我运行php artisan update命令时,出现以下错误:

[PDOException] [PDOException]
SQLSTATE[HY000] [2002] Connection refused SQLSTATE [HY000] [2002]连接被拒绝

This is obviously database related. 这显然与数据库有关。 This happens on a production machine I have as well as local environment. 这发生在我拥有的生产机器以及本地环境上。 My site is working in both environments. 我的网站在两种环境中都可以工作。

Does anyone understand this error? 有人知道这个错误吗? Thanks. 谢谢。

You are missing the PHP-CLI database extension. 您缺少PHP-CLI数据库扩展。 Your site does work because your server is using the PHP-FPM (where you have the PHP extention of your database installed). 您的站点可以正常工作,因为您的服务器正在使用PHP-FPM(已在其中安装了数据库的PHP扩展)。 But when you run php artisan migrate command you are actually executing it on the PHP-CLI. 但是,当您运行php artisan migrate命令时,实际上是在PHP-CLI上执行它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM