0

I'm using Laravel Forge to deploy a PHP site to a Ubuntu 16.04 x64 server. I deployed the site via git, and the site is up and running.

However, when I try to deploy new changes via git and Forge, I get the following error:

> php artisan optimize
Generating optimized class loader


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

I get the same [PDOException] error on my local machine at the end of the following commands:

composer install --no-interaction

php artisan clear-compiled

php artisan optimize

php artisan migrate

Here is my Laravel .env file:

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

Here is my config/database.php file:

   '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,

When I try to connect to the remote database on Sequel Pro, I can SSH in, but then I get this error:

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 [email protected]
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 [email protected] 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

There is something going on with git and the database and Forge, but I can't figure it out.

Any help is appreciate, thanks.

2
  • i think you should change the DB_HOST variable (thats your localhost adress Commented May 24, 2016 at 20:54
  • thanks, see my reply below. Commented May 25, 2016 at 8:37

1 Answer 1

0

try this

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

dont forget to put your password too and port(if thats not the default)

and in your localmachine you should change that too

Sign up to request clarification or add additional context in comments.

7 Comments

Thanks for the reply. I tried changing the DB_Host like you suggested, but still got the error. But I am noticing that my deployments are working, it's just that I'm getting this error. For now I can continue, it's just some laravel issue...
I think the issue may be that I don't have a database and forge thinks I do? any ideas on this? thanks.
does your app require a database?
I don't know if laravel 5 does. I don't think I'm using it, as it's just a simple site with pages. I think forge builds a database though. It sent me the credentials in any case.
if you have pages without needing a data base, you need to change the env variables from the forge panel i guess
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.