Laravel Forge不会使用git进行部署

时间:2016-05-24 20:46:27

标签: php git laravel ubuntu forge

我正在使用Laravel Forge将PHP站点部署到Ubuntu 16.04 x64服​​务器。我通过git部署了该站点,该站点已启动并运行。

但是,当我尝试通过git和Forge部署新的更改时,我收到以下错误:

> php artisan optimize
Generating optimized class loader


  [PDOException]                             
  SQLSTATE[HY000] [2002] Connection refused  

在以下命令的末尾,我在本地计算机上遇到相同的[PDOException]错误:

composer install --no-interaction

php artisan clear-compiled

php artisan optimize

php artisan migrate

这是我的Laravel .env文件:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=forge
DB_USERNAME=forge
DB_PASSWORD=MYPASSWORD

这是我的config / database.php文件:

   'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', 'MYPASSWORD'),
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,

当我尝试连接到Sequel Pro上的远程数据库时,我可以通过SSH登录,但后来我收到了这个错误:

debug1: channel 1: new [port listener]
debug1: Local connections to LOCALHOST:53986 forwarded to remote address 188.166.19.36:3306
debug1: Local forwarding listening on ::1 port 53986.
debug1: channel 2: new [port listener]
debug1: Local forwarding listening on 127.0.0.1 port 53986.
debug1: channel 3: new [port listener]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Connection to port 53985 forwarding to 127.0.0.1 port 3306 requested.
debug1: channel 4: new [direct-tcpip]
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
channel 4: open failed: connect failed: Connection refused
debug1: channel 4: free: direct-tcpip: listening port 53985 for 127.0.0.1 port 3306, connect from 127.0.0.1 port 53988 to 127.0.0.1 port 53985, nchannels 5
debug1: Connection to port 53986 forwarding to 188.166.19.36 port 3306 requested.
debug1: channel 4: new [direct-tcpip]
channel 4: open failed: connect failed: Connection refused
debug1: channel 4: free: direct-tcpip: listening port 53986 for 188.166.19.36 port 3306, connect from 127.0.0.1 port 53989 to 127.0.0.1 port 53986, nchannels 5

git和数据库以及Forge都有一些问题,但我无法理解。

感谢任何帮助,谢谢。

1 个答案:

答案 0 :(得分:0)

试试这个

DB_HOST=188.166.19.36 // i think this is the host ip if not change it to the right address

别忘了把密码和端口(如果那不是默认设置)

并且在本地机器中你也应该改变它