Laravel .env Cheatsheet
Every value a Laravel project needs to talk to Rezure's services, in one place. After editing .env, run php artisan config:clear if you've cached your config.
App
APP_URL=http://myapp.testUse your project's domain from the Projects page, over plain http://; there's no local HTTPS.
MariaDB or MySQL
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=- Create
myappon the Databases page first (New database). DB_CONNECTION=mariadbworks too on Laravel 11 and newer.- An adopted Laragon or XAMPP data directory keeps its own users. See MariaDB & MySQL.
PostgreSQL
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=- Turn on
pdo_pgsqlon PHP Extensions: it's off by default. postgresworks as the username too. Any password is accepted.- Create the database on the Databases page with the PostgreSQL connection selected.
See PostgreSQL.
SQL Server LocalDB
DB_CONNECTION=sqlsrv
DB_HOST=(localdb)\Rezure
DB_PORT=
DB_DATABASE=myapp
DB_USERNAME=
DB_PASSWORD=Install
pdo_sqlsrvon PHP Extensions and the ODBC Driver.Keep
DB_PORT=present and empty, or Laravel appends,1433and the connection fails.An empty username means Windows authentication.
Certificate error with ODBC Driver 18? Uncomment
'trust_server_certificate'inconfig/database.phpand add:dotenvDB_TRUST_SERVER_CERTIFICATE=true
See SQL Server.
Another SQL Server
DB_CONNECTION=sqlsrv
DB_HOST=db.office.local
DB_PORT=1433
DB_DATABASE=myapp
DB_USERNAME=app_user
DB_PASSWORD=secretFor a named instance, use DB_HOST=db.office.local\SQLEXPRESS and leave DB_PORT= empty.
Mail (Mailpit)
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=nullNot MAIL_HOST=mailpit (that's Laravel Sail's Docker hostname) and not port 2525 (Laravel's default). Open the inbox at http://127.0.0.1:8025. See Mailpit.
Cache, queue, and session
Rezure has no Redis server yet, so keep Laravel's database- or file-backed drivers:
CACHE_STORE=database
QUEUE_CONNECTION=database
SESSION_DRIVER=databaseRun php artisan queue:work in a project terminal to process queued jobs. The redis PHP extension can be installed from PHP Extensions if you point Laravel at a Redis server running elsewhere.
Check it
The project's Requirements Check reads .env and flags the common mistakes above for the default database connection and for mail, with a fix button where there is one.
Related
- First Run: the first database connection
- Project Terminal:
php artisan migrateon the right PHP