Report this

What is the reason for this report?

How to link my DB and my Laravel project 500 Error

Posted on July 27, 2021

Hello everybody

i have issue with my Laravel project .

now i have deploy every thing to online

the issue is when i am trying to get my API its giving me 500 Error and when i checked the log i got the below logs

[db] [2021-07-27 13:32:43] postgresql-12.service [14-1] pid=7152,user=[unknown],db=[unknown],app=[unknown],client=[local] LOG connection received: host=[local] [db] [2021-07-27 13:32:43] postgresql-12.service [15-1] pid=7152,user=postgres,db=db,app=[unknown],client=[local] LOG connection authorized: user=postgres database=db application_name=do-pruned [db] [2021-07-27 13:32:43] postgresql-12.service [16-1] pid=7152,user=postgres,db=db,app=do-pruned,client=[local] LOG disconnection: session time: 0:00:00.007 user=postgres database=db host=[local] [db] [2021-07-27 13:32:43] postgresql-12.service [14-1] pid=7153,user=[unknown],db=[unknown],app=[unknown],client=[local] LOG connection received: host=[local] [db] [2021-07-27 13:32:43] postgresql-12.service [15-1] pid=7153,user=postgres,db=defaultdb,app=[unknown],client=[local] LOG connection authorized: user=postgres database=defaultdb application_name=do-pruned [db] [2021-07-27 13:32:43] postgresql-12.service [16-1] pid=7153,user=postgres,db=defaultdb,app=do-pruned,client=[local] LOG disconnection: session time: 0:00:00.010 user=postgres database=defaultdb host=[local] [db] [2021-07-27 13:32:53] postgresql-12.service [14-1] pid=7165,user=[unknown],db=[unknown],app=[unknown],client=[local] LOG connection received: host=[local] [db] [2021-07-27 13:32:53] postgresql-12.service [15-1] pid=7165,user=postgres,db=db,app=[unknown],client=[local] LOG connection authorized: user=postgres database=db application_name=do-pruned [db] [2021-07-27 13:32:53] postgresql-12.service [16-1] pid=7165,user=postgres,db=db,app=do-pruned,client=[local] LOG disconnection: session time: 0:00:00.010 user=postgres database=db host=[local] [db] [2021-07-27 13:32:53] postgresql-12.service [14-1] pid=7166,user=[unknown],db=[unknown],app=[unknown],client=[local] LOG connection received: host=[local] [db] [2021-07-27 13:32:53] postgresql-12.service [15-1] pid=7166,user=postgres,db=defaultdb,app=[unknown],client=[local] LOG connection authorized: user=postgres database=defaultdb application_name=do-pruned [db] [2021-07-27 13:32:53] postgresql-12.service [16-1] pid=7166,user=postgres,db=defaultdb,app=do-pruned,client=[local] LOG disconnection: session time: 0:00:00.011 user=postgres database=defaultdb host=[local]

so what is the issue exactly i need to know as i can see its between the DB but i don’t know the solution

Regards



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hello,

It looks like that you need to make sure that you’ve specified the correct database credentials in your .env file.

If you are using a Droplet, you can follow the steps on how to do that here:

https://www.digitalocean.com/community/tutorials/how-to-deploy-a-laravel-application-with-nginx-on-ubuntu-16-04

In case that you are using the App platform you could take a look at this answer here that shows how you could add your database details as env variables:

https://www.digitalocean.com/community/questions/how-to-connect-laravel-project-in-app-platform-to-database-managed-cluster

Let me know how it goes! Regards, Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.