Fix this error
Fix common errors
Paste the error message you got. Each page explains why it happens and the exact steps to fix it, for Laravel, PHP, MySQL, Composer, npm and more.
12 errors
CORS: No 'Access-Control-Allow-Origin' header is present
Access to fetch at 'https://api.example.com/api/users' from origin 'https://app.example.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
The browser blocks a request from one origin (domain, port or protocol) to another unless the server allows it with CORS headers. In Laravel, the path is not in config/cors.php, th...
laravel
api
javascript
Laravel: Vite manifest not found
Vite manifest not found at: /var/www/html/public/build/manifest.json
The page uses @vite(...) but the front-end assets were never built, or the public/build folder was not uploaded to the server. Locally it also happens when npm run dev is not runni...
laravel
vite
deployment
PHP: Class not found
Error: Class "App\Services\PaymentService" not found
Composer's autoloader cannot find a file for that class. Usually: The namespace does not match the folder (App\Services must be in app/Services). The file or class name differs in...
php
composer
laravel
Laravel: 419 Page Expired
419 | Page Expired
Laravel rejects a POST, PUT, PATCH or DELETE request when its CSRF token is missing or does not match the one in the session. Common reasons: The form has no @csrf field. The page...
laravel
csrf
sessions
SQLSTATE[HY000] [2002] Connection refused
SQLSTATE[HY000] [2002] Connection refused (Connection: mysql, SQL: select * from `users` ...)
PHP reached the database host, but nothing accepted the connection on that port. Usually: MySQL / MariaDB is not running. DB_HOST or DB_PORT in .env is wrong. In Docker, 127.0.0.1...
laravel
mysql
database
SQLSTATE[HY000] [1045] Access denied for user
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
The database server is running, but it rejected the username or password, or that user is not allowed to connect from this host. DB_USERNAME / DB_PASSWORD in .env are wrong. The pa...
laravel
mysql
database
Laravel: No application encryption key has been specified
No application encryption key has been specified.
APP_KEY in .env is empty or missing. Laravel needs it to encrypt cookies and sessions. This usually happens right after cloning a project or copying .env.example, or when an old ca...
laravel
deployment
Laravel: storage/logs/laravel.log could not be opened: Permission denied
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The web server user (often www-data, nginx or apache) cannot write to storage/ or bootstrap/cache/. This happens after uploading files as another user, running artisan as root, or...
laravel
linux
deployment
Laravel: Target class [Controller] does not exist
Target class [UserController] does not exist.
Since Laravel 8, routes are not prefixed with the App\Http\Controllers namespace any more. A route written as 'UserController@index' (a string) can't be found. A typo in the class...
laravel
routing
PHP: Allowed memory size exhausted
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)
The script used more memory than PHP's memory_limit (134217728 bytes = 128 MB). Most often it loads too much at once, like Model::all() on a big table, or builds a huge array or fi...
php
laravel
performance
SQLSTATE[42S22]: Column not found: 1054 Unknown column
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'status' in 'field list'
The query uses a column the table doesn't have. Usually a migration that adds it was not run on this database, the name has a typo, or Eloquent is adding created_at / updated_at to...
laravel
mysql
database
Laravel: Add [field] to fillable property to allow mass assignment
Add [title] to fillable property to allow mass assignment on [App\Models\Post].
Model::create() and fill() only accept attributes listed in the model's $fillable array. This protects you from users setting fields like is_admin through a form.
laravel
eloquent
