SECURITY WARNING: Never run commands you don't understand. Always review code before execution. Use at your own risk.
PHP 11 errors

PHP & Laravel Errors

Memory limits, execution timeouts, autoloading, Composer and PDO connections.

Understanding PHP errors

PHP errors are dominated by per-request resource limits (memory_limit, max_execution_time) and by autoloading. Class-not-found errors are almost never missing code. They are a namespace that does not match the PSR-4 mapping, or a stale Composer autoload map. Laravel adds a caching layer that produces genuinely confusing errors when configuration is cached with the wrong environment.

How to debug PHP errors

  1. Read the real limits from the running process, not from a config file: php -i | grep -E 'memory_limit|max_execution_time'. CLI and FPM have separate configurations.
  2. Regenerate the autoload map with composer dump-autoload -o before investigating a class-not-found error any further.
  3. For Laravel, clear cached config and routes with php artisan optimize:clear. A config cache built in the wrong environment causes errors that survive every code change.
  4. Enable full error display in development (display_errors=On, error_reporting=E_ALL). The default production settings hide the cause.
  5. For PDO connection refusals, test the same credentials with the database's own CLI client to separate PHP configuration from database access.

Tools worth reaching for

  • php -i
  • composer dump-autoload -o
  • php artisan optimize:clear
  • Xdebug
  • tail -f storage/logs/laravel.log

All 11 PHP errors

Other categories