B
B
BonBon Slick2017-09-07 12:42:26
PostgreSQL
BonBon Slick, 2017-09-07 12:42:26

Laravel Homestead DB port 5432 is running - site, but artisan is broken, 54320 is running artisan - site is broken?

The whole point is in the question, if in the .env file such a port DB_PORT=54320runs console commands with php artisan migrate, tables are created, etc., but the site gives an error:

SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host 
"127.0.0.1" and accepting TCP/IP connections on port 54320? (SQL: select * from "users" where 
"id" = 1 and "users"."deleted_at" is null limit 1)

And vice versa, if the port DB_PORT=5432is working on the site, the same error is displayed in the console if you enter artisan migrate and other commands related to the database.
I want to note that when connecting to the database via PhpStorm, only port 5432 accepts, 54320 issues Failed.
Also, connecting via SSH .. -U homestead... works.
Another thing I noticed, if you disable additional database connection parameters in phPSorm, SSH / SSL, and set the desired port to 54320, then the test connection works. However, the site is still lying, I don’t understand why this Vagrant is crap, 2 days to set it up, even Windows had to be interrupted because Homestead broke paths due to Cyrillic ....
The PhPStorm console issues:
Last login: Thu Sep  7 11:03:40 2017 from 10.0.2.2
[email protected]:~$ ps -f -u postgres
UID        PID  PPID  C STIME TTY          TIME CMD
postgres   897     1  0 11:03 ?        00:00:00 /usr/lib/postgresql/9.5/bin/postgres -D /var/lib/postgresql/9.5/main -c config_file=/etc/postgresql/9.5/main/postgresql.conf
postgres   922   897  0 11:03 ?        00:00:00 postgres: checkpointer process   
postgres   923   897  0 11:03 ?        00:00:00 postgres: writer process   
postgres   924   897  0 11:03 ?        00:00:00 postgres: wal writer process   
postgres   925   897  0 11:03 ?        00:00:00 postgres: autovacuum launcher process   
postgres   926   897  0 11:03 ?        00:00:00 postgres: stats collector process   

[email protected]:~$ psql -U homestead -h localhost my_db_name
Password for user homestead: 
psql: FATAL:  database "my_db_name" does not exist

But with vagrant up, it was clearly stated that the database was created.
We try Putty, set the connection settings everywhere the same, both in the IDE and here for SSH^\:
Last login: Tue Sep  5 08:35:23 2017 from 10.0.2.2

[email protected]:~$ psql -U homestead -h localhost my_db_name
Password for user homestead:
psql (9.5.7)
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.

my_db_name=# SHOW port;
 port
------
 5432
(1 row)

my_db_name=# SHOW listen_addresses;
 listen_addresses
------------------
 *
(1 row)

We see that PGSQL is configured correctly, listening to all ports as I understand it:
listen_addresses
------------------
 *

Okay, that is, if you return 5432 to .env , the site will work, however, as I understand it, it should also accept 54320, right?
And why doesn't the migrate command , etc., work from the console? The rest of the commands, make:model, migration ... work as they should.
Why is that?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question