PHP errors

PHP fatal errors, warnings, parse errors and configuration limits.

CodeErrorWhat it means
Undefined array key Warning: Undefined array key / Undefined index Your code reads an array key that doesn’t exist — common with `$_GET`, `$_POST` and decoded JSON.
Implicit float to int Deprecated: Implicit conversion from float 2.5 to int loses precision PHP 8.1+ warns when a float with a fractional part is silently converted to int (array keys, % operator, int…
Call to undefined function PHP Fatal error: Uncaught Error: Call to undefined function PHP can’t find the function you called — usually a missing extension, missing include, or namespace issue.
Parse error PHP Parse error: syntax error, unexpected … PHP can’t parse the file because of a syntax mistake — the real error is often on the line before the one rep…
mysqli_sql_exception Fatal error: Uncaught mysqli_sql_exception A MySQLi query or connection failed; since PHP 8.1 MySQLi throws exceptions by default.
Cannot redeclare Fatal error: Cannot redeclare function foo() (previously declared in …) The same function (or class) was defined twice — usually a file included more than once.
cURL error 28 cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received A PHP cURL (or Guzzle) request timed out before the remote server answered.
TypeError Fatal error: Uncaught TypeError: foo(): Argument #1 ($x) must be of type int, string given A function received a value of the wrong type for a typed parameter.
could not find driver PDOException: could not find driver The PDO driver for your database (pdo_mysql, pdo_pgsql, pdo_sqlite) isn’t installed or enabled.
Array to string conversion Warning: Array to string conversion An array was used where a string is expected — echoing it, concatenating it, or passing it to a string functi…
Undefined variable Warning: Undefined variable $x PHP read a variable that was never assigned in the current scope.
Call to member function on null Fatal error: Uncaught Error: Call to a member function x() on null Code called a method on a variable that is null instead of an object.
DivisionByZeroError Fatal error: Uncaught DivisionByZeroError: Division by zero Code divided by zero (or used modulo by zero) — PHP 8 throws instead of warning.
Unsupported operand types Fatal error: Uncaught TypeError: Unsupported operand types: string + int An arithmetic or array operator was used with incompatible types (PHP 8 is stricter than PHP 7).
cURL error 35 cURL error 35: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to host:443 The TLS handshake failed — protocol/cipher mismatch, a proxy interfering, or the server closed the connection.
Primary script unknown FastCGI sent in stderr: "Primary script unknown" Nginx passed a script path to PHP-FPM that PHP-FPM couldn’t find — usually a wrong SCRIPT_FILENAME or root.
ArgumentCountError Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo(), 1 passed and exactly 2 expected A function was called with fewer arguments than it requires.
Maximum execution time PHP Fatal error: Maximum execution time of 30 seconds exceeded The script ran longer than `max_execution_time` and PHP stopped it.
intl missing Class "NumberFormatter" not found / The "intl" PHP extension is required Code uses the intl extension (NumberFormatter, Collator, IntlDateFormatter) but it isn’t installed.
Uncaught Exception Fatal error: Uncaught Exception: message in file.php:12 An exception was thrown and nothing caught it, so PHP stopped the script.
failed to open stream Warning: include(x.php): Failed to open stream: No such file or directory PHP couldn’t open a file for include/require/fopen — wrong path, missing file, or no permission.
cURL error 6 cURL error 6: Could not resolve host: api.example.com PHP cURL couldn’t resolve the hostname via DNS.
Allowed memory size exhausted PHP Fatal error: Allowed memory size of X bytes exhausted The script tried to use more memory than PHP’s `memory_limit` allows.
BOM output Unexpected characters at the top of the page / headers already sent by BOM A UTF-8 byte-order mark (BOM) at the start of a PHP file is sent as output, breaking headers, JSON and images.
session save path Warning: session_start(): open(/var/lib/php/sessions/sess_x, O_RDWR) failed: Permission denied PHP can’t write session files to the configured session.save_path.
Deprecated null to internal Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated PHP 8.1+ warns when null is passed to a built-in function that expects a string/int.
Maximum function nesting Fatal error: Maximum function nesting level of '256' reached, aborting! Recursion went deeper than Xdebug’s max_nesting_level allows (or PHP crashed with a segfault without Xdebug).
json_decode null json_decode() returns null / JSON_ERROR_SYNTAX: Syntax error The string passed to json_decode isn’t valid JSON, so PHP returns null.
PHP mail PHP mail() returns false / emails not delivered PHP’s mail() function failed or emails never arrive (spam or rejected).
Headers already sent Warning: Cannot modify header information - headers already sent You called `header()`, `setcookie()` or `session_start()` after output had already been sent to the browser.
Array offset on null Warning: Trying to access array offset on value of type null Code used `$x['key']` where `$x` is null — usually a lookup or function that returned nothing.
Composer memory Composer: PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted Composer ran out of memory while resolving or installing dependencies.
419 Page Expired Laravel: 419 Page Expired (CSRF token mismatch) Laravel rejected a POST because the CSRF token was missing, expired or didn’t match the session.
SQLSTATE[HY000] [2002] PDOException: SQLSTATE[HY000] [2002] Connection refused PHP couldn’t reach the database server at the host/port in your DSN.
OPcache stale code PHP still runs old code after deploy (OPcache not reset) OPcache keeps serving cached bytecode, so changes uploaded to the server don’t take effect.
session_start() Warning: session_start(): Session cannot be started after headers have already been sent session_start() ran after output was sent, so PHP can’t set the session cookie.
Cannot use object as array Fatal error: Uncaught Error: Cannot use object of type stdClass as array Code used array syntax (`$x['key']`) on an object.
No application encryption key Laravel: No application encryption key has been specified. Laravel’s APP_KEY is missing, so it can’t encrypt sessions and cookies.
Target class does not exist Laravel: Target class [App\Http\Controllers\X] does not exist. Laravel’s container couldn’t find the controller or class named in a route or binding.
Undefined property Warning: Undefined property: Class::$prop Code read an object property that doesn’t exist on that object.
max_input_vars Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. The form submitted more fields than PHP’s max_input_vars allows; extra fields were silently dropped.
Composer conflict Your requirements could not be resolved to an installable set of packages. Composer can’t find package versions that satisfy every constraint (PHP version, extensions, other packages).
Dynamic property deprecated Deprecated: Creation of dynamic property Foo::$bar is deprecated PHP 8.2+ deprecates creating properties that aren’t declared in the class.
GD missing Fatal error: Uncaught Error: Call to undefined function imagecreatefromjpeg() The GD extension (or its JPEG/WebP support) isn’t installed for the PHP version serving the site.
Laravel table not found Laravel: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.sessions' doesn't exist Laravel queried a table that hasn’t been created — usually sessions, cache, jobs or a new model’s table.
Laravel storage Laravel: The stream or file "storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The web server can’t write to Laravel’s storage or bootstrap/cache directories.
UPLOAD_ERR_INI_SIZE PHP upload error 1: The uploaded file exceeds the upload_max_filesize directive in php.ini The uploaded file is bigger than PHP’s upload_max_filesize, so PHP discarded it.
Class not found PHP Fatal error: Uncaught Error: Class "X" not found PHP couldn’t load the class — autoloading failed, the namespace is wrong, or the dependency isn’t installed.
open_basedir Warning: file_exists(): open_basedir restriction in effect. File(/x) is not within the allowed path(s) PHP is configured to access only certain directories, and the script tried to touch a file outside them.
Vite manifest not found Laravel: Vite manifest not found at: public/build/manifest.json Laravel’s @vite directive can’t find the compiled asset manifest because assets weren’t built.