php Errors
20 error patterns
Undefined variable used
Undefined variable.*\$
- •Initialize the variable before use
- •Check for typos in the variable name
PHP class not found
Class ['"].*['"] not found
- •Run composer dump-autoload to regenerate autoload files
- •Check namespace matches directory structure (PSR-4)
Database table does not exist
SQLSTATE\[42S02\].*Table.*doesn't exist
- •Run php artisan migrate to create the table
- •Check table name in migration matches what the model expects
Duplicate key constraint violation
SQLSTATE\[23000\].*Integrity constraint violation.*Duplicate entry
- •Use firstOrCreate() or updateOrCreate() instead of create()
- •Add unique validation rule before saving
Array offset undefined or null access
Undefined.*offset|Trying to access array offset on.*null
- •Check array key exists: isset($arr['key']) or array_key_exists()
- •Use null coalescing: $arr['key'] ?? 'default'
Blade view template not found
View \[.*\] not found
- •Check the view path matches file location: resources/views/path/file.blade.php
- •Verify dot notation matches directory separators
CSRF token validation failed
CSRF token mismatch
- •Add @csrf directive inside your form
- •For AJAX: include X-CSRF-TOKEN header from meta tag
Session not available in request
Session store not set on request
- •Ensure the route is within the 'web' middleware group
- •Check session driver configuration in .env and config/session.php
Laravel container cannot resolve class
Target class \[.*\] does not exist
- •Check controller namespace in route file (Laravel 8+ requires full namespace)
- •Register the binding in a Service Provider
PHP max execution time exceeded
Maximum execution time of.*seconds exceeded
- •Optimize the slow operation (add database indexes, reduce loops)
- •Increase max_execution_time in php.ini for legitimate long operations
PHP memory limit exhausted
Allowed memory size of.*bytes exhausted
- •Use chunk() or cursor() for large Eloquent queries
- •Increase memory_limit in php.ini if the operation legitimately needs more
Call to undefined static method
Call to undefined method.*::
- •Check the class actually has this static method
- •Verify you're not calling an instance method statically
Database column not found
SQLSTATE\[42S22\].*Column not found
- •Create a migration to add the column: php artisan make:migration
- •Check for typos in column name
HTTP method not supported for route
The (GET|POST|PUT|DELETE) method is not supported for (route|this route)
- •Check your form method matches the route definition
- •Add @method('PUT') or @method('DELETE') for spoofed methods
Accessing undefined property on class
ErrorException.*Undefined property.*::\$
- •Declare the property in the class definition
- •Check for typos in the property name
Class not found during dependency injection
ReflectionException.*Class.*does not exist
- •Run composer dump-autoload to regenerate class map
- •Verify the class namespace and file path follow PSR-4
File write permission denied
file_put_contents.*Permission denied
- •Fix permissions: chmod -R 775 storage bootstrap/cache
- •Set correct ownership: chown -R www-data:www-data storage
Composer dependency resolution failed
Your requirements could not be resolved to an installable set of packages
- •Run composer update --with-all-dependencies to resolve together
- •Check for PHP version requirements in failed packages
Database connection refused
Illuminate\\Database\\QueryException.*SQLSTATE\[HY000\].*Connection refused
- •Verify database service is running
- •Check .env DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME, DB_PASSWORD
Required field validation failure
The.*field is required|validation\.required
- •Ensure the form input name matches the validation rule key
- •Check that the field is included in the request (not empty/missing)