3

How do I set the application_name as defined here http://www.postgresql.org/docs/9.1/static/libpq-connect.html, in Laravel? I see that you can do "SET application_name = 'application'" but this does not work for me. I also tried setting it in the app/config/database.php file in the 'connections' array. What am I doing wrong?

2 Answers 2

3

You have to put in the env file (/.env) the variable regarding the application name named DB_APPLICATION_NAME = ;

And you have to specify the following: Form Laravel version 5.5 you can add this row to the file /config/database.php at the bottom of the postgresql connection. 'application_name' => env('DB_APPLICATION_NAME', 'Laravel')

If you don't specify the app name in the .env file the application name will be taken from /config/database.php file.

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

1 Comment

Make sure your application name doesn't have any single quotes in it, because laravel doesn't quote or prepare those like you might expect.
0
# database.php
'application_name' => env('DB_APPLICATION_NAME', 'Laravel')

Comments

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.