Skip to content
FR
  1. LuzineDebug
  2. PHP & Laravel

PHP & Laravel errors: causes and fixes

PHP and Laravel errors: 419 Page Expired, memory exhausted, class not found, database connection refused. Tested fixes with the Artisan and Composer commands to run.

419 | Page Expired

Fix "419 Page Expired" in Laravel (CSRF token mismatch)

Laravel rejected a POST, PUT, PATCH or DELETE request because the CSRF token is missing or does not match the one stored in the se…

Beginner 10 min
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2048…

Fix "Allowed memory size of 134217728 bytes exhausted" in PHP

The PHP script exceeded its memory_limit (134217728 bytes = 128 MB, the default value). Before raising the limit, find what uses t…

Intermediate 20 min
Target class [App\Http\Controllers\UserController] does not exist.

Fix "Target class [X] does not exist" and "Class not found" in Laravel

Laravel or PHP cannot load the requested class. Check that the namespace exactly matches the file path (including letter case), us…

Beginner 10 min
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `sessions…

Fix "SQLSTATE[HY000] [2002] Connection refused" in Laravel

PHP cannot open a network connection to MySQL: nothing is listening at the given address and port. Check that the MySQL server is…

Beginner 10 min
No application encryption key has been specified.

Fix "No application encryption key has been specified" in Laravel

Laravel’s APP_KEY variable is empty or missing, so Laravel cannot encrypt cookies or sessions. Create the .env file if it is missi…

Beginner 5 min
Your requirements could not be resolved to an installable set of packages.

Fix "Your requirements could not be resolved to an installable set of packages" (Composer)

Composer cannot find any combination of versions that meets every constraint: PHP version too old, missing ext-* extension, or two…

Intermediate 15 min
The stream or file "/var/www/storage/logs/laravel.log" could not be opened in append mode:…

Fix "laravel.log could not be opened in append mode: Permission denied"

The web server’s PHP process (often www-data) is not allowed to write to storage/logs/laravel.log. Give the web server group to th…

Intermediate 10 min
Vite manifest not found at: /var/www/public/build/manifest.json

Fix "Vite manifest not found at: public/build/manifest.json" in Laravel

Laravel’s @vite directive finds neither the Vite dev server nor the built files. Locally, run npm install then npm run dev; for pr…

Beginner 5 min

Other areas