Ffile2fix
Sign in Get started

Error fixes

Fix the error you are looking at.

Plain-English explanations and step-by-step fixes for 154 common PHP, server, WordPress, database, archive and tooling errors, with the File2fix tool that helps where there is one.

Archives & Files

Composer & npm

Fix "Composer detected issues in your platform" (PHP version)

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0". You…

Fix Composer "Allowed memory size exhausted"

PHP Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in…

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

Your requirements could not be resolved to an installable set of packages. Problem 1 - Root…

Fix Composer: zip extension and unzip/7z commands are both missing

Failed to download laravel/framework from dist: The zip extension and unzip/7z commands are both missing…

Fix SyntaxError: Cannot use import statement outside a module

SyntaxError: Cannot use import statement outside a module

Fix npm "EACCES: permission denied"

npm ERR! code EACCES npm ERR! syscall mkdir npm ERR! path /usr/local/lib/node_modules/typescript npm ERR!…

Fix npm "ERESOLVE unable to resolve dependency tree"

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

Fix: require vendor/autoload.php Failed to open stream

Warning: require(/home/user/public_html/vendor/autoload.php): Failed to open stream: No such file or…

How to fix "JavaScript heap out of memory" in Node.js

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory

How to fix Error: Cannot find module in Node.js

Error: Cannot find module 'express' Require stack: - /home/user/app/server.js code: 'MODULE_NOT_FOUND'

How to fix Error: listen EADDRINUSE: address already in use :::3000

Error: listen EADDRINUSE: address already in use :::3000

Data formats

Database

Fix "Access denied for user" in MySQL and MariaDB

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

Fix "Duplicate entry for key" in MySQL (error 1062)

ERROR 1062 (23000): Duplicate entry '1' for key 'PRIMARY'

Fix "Incorrect string value" in MySQL (error 1366)

ERROR 1366 (HY000): Incorrect string value: '\xF0\x9F\x98\x80' for column 'comment' at row 1

Fix "MySQL server has gone away" (error 2006)

ERROR 2006 (HY000): MySQL server has gone away

Fix "Too many connections" in MySQL (error 1040)

ERROR 1040 (HY000): Too many connections

Fix "Unknown column in 'field list'" in MySQL (error 1054)

ERROR 1054 (42S22): Unknown column 'email' in 'field list'

How to fix #1071 Specified key was too long; max key length is 767

#1071 - Specified key was too long; max key length is 767 bytes

How to fix MySQL "ERROR 1064: You have an error in your SQL syntax"

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL…

How to fix MySQL "ERROR 1146: Table doesn't exist"

ERROR 1146 (42S02): Table 'appdb.wp_options' doesn't exist

How to fix MySQL "ERROR 1205: Lock wait timeout exceeded"

ERROR 1205 (HY000): Lock wait timeout exceeded; try restarting transaction

How to fix MySQL "ERROR 1215: Cannot add foreign key constraint"

ERROR 1215 (HY000): Cannot add foreign key constraint

How to fix MySQL "ERROR 2002: Can't connect through socket"

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

How to fix phpMyAdmin "tried to upload a file that is too large"

You probably tried to upload a file that is too large. Please refer to the documentation for a workaround…

Git

HTTP & Server

Fix "403 Forbidden" on Apache and Nginx

Forbidden You don't have permission to access this resource.

Fix "413 Request Entity Too Large"

413 Request Entity Too Large nginx

Fix "500 Internal Server Error"

Internal Server Error The server encountered an internal error or misconfiguration and was unable to…

Fix "502 Bad Gateway" in Nginx

502 Bad Gateway nginx

Fix "503 Service Unavailable"

Service Unavailable The server is temporarily unable to service your request due to maintenance downtime or…

Fix "504 Gateway Time-out"

504 Gateway Time-out nginx

Fix "ERR_TOO_MANY_REDIRECTS"

This page isn't working example.com redirected you too many times. Try deleting your…

Fix "nginx: configuration file test failed"

nginx: [emerg] unexpected "}" in /etc/nginx/sites-enabled/example.com:42 nginx: configuration file…

Fix .htaccess "Invalid command ... perhaps misspelled"

/home/user/public_html/.htaccess: Invalid command 'php_value', perhaps misspelled or defined by a module not…

Fix .htaccess rewrite rules returning 404 Not Found

Not Found The requested URL was not found on this server.

Fix CORS "No 'Access-Control-Allow-Origin' header"

Access to fetch at 'https://api.example.com/data' from origin 'https://example.com' has been blocked by CORS…

Fix Nginx "connect() failed (111: Connection refused)"

[error] 1234#1234: *1 connect() failed (111: Connection refused) while connecting to upstream, client…

Fix a cron job that is not running

(CRON) info (No MTA installed, discarding output)

How to fix ".htaccess: Options not allowed here"

/home/user/public_html/.htaccess: Options not allowed here

How to fix "/bin/sh: php: command not found" in cron jobs

/bin/sh: php: command not found

How to fix "400 Bad Request: Request Header Or Cookie Too Large"

400 Bad Request Request Header Or Cookie Too Large nginx

How to fix "405 Method Not Allowed"

405 Not Allowed nginx

How to fix "414 Request-URI Too Long"

414 Request-URI Too Large

How to fix "429 Too Many Requests"

429 Too Many Requests

How to fix "508 Resource Limit Is Reached" on shared hosting

Resource Limit Is Reached. The website is temporarily unable to service your request as it exceeded resource…

How to fix "AH01630: client denied by server configuration"

[authz_core:error] [pid 12345] [client 203.0.113.5:51234] AH01630: client denied by server configuration…

How to fix "ERR_CONNECTION_REFUSED"

This site can't be reached example.com refused to connect. ERR_CONNECTION_REFUSED

How to fix "Invalid command 'RewriteEngine'" in Apache

/var/www/html/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not…

How to fix "RewriteRule: bad flag delimiters" in .htaccess

/home/user/public_html/.htaccess: RewriteRule: bad flag delimiters

How to fix "errors in crontab file, can't install"

crontab: installing new crontab "/tmp/crontab.Xy12ab/crontab":3: bad minute errors in crontab file, can't…

How to fix 404 Not Found on every page after migrating a site

Not Found. The requested URL was not found on this server.

How to fix 550 5.7.1 / 5.7.26 email rejected (SPF or DMARC fail)

550 5.7.26 Unauthenticated email from example.com is not accepted due to domain's DMARC policy. Please…

How to fix Apache "Could not reliably determine the server's FQDN"

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1…

How to fix Apache AH00124: exceeded the limit of 10 internal redirects

AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use…

How to fix Apache AH01630 "client denied by server configuration"

AH01630: client denied by server configuration: /var/www/html/index.php

How to fix DNS_PROBE_FINISHED_NXDOMAIN for your domain

This site can't be reached. Check if there is a typo in example.com. DNS_PROBE_FINISHED_NXDOMAIN

How to fix Nginx "Primary script unknown"

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client…

How to fix Nginx "conflicting server name ... ignored"

nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored

How to fix Nginx "could not build server_names_hash"

nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64

How to fix Nginx "php-fpm.sock failed (2: No such file or directory)"

connect() to unix:/run/php/php-fpm.sock failed (2: No such file or directory) while connecting to upstream

How to fix Nginx "upstream timed out (110: Connection timed out)"

upstream timed out (110: Connection timed out) while reading response header from upstream, client…

How to fix PHPMailer "SMTP Error: Could not authenticate"

SMTP Error: Could not authenticate.

How to fix a 500 error after editing .htaccess

/home/user/public_html/.htaccess: Invalid command 'Header', perhaps misspelled or defined by a module not…

How to fix nginx bind() to 0.0.0.0:80 failed (Address already in use)

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

How to fix nginx: [emerg] unknown directive

nginx: [emerg] unknown directive "more_set_headers" in /etc/nginx/sites-enabled/example.com:14

PHP

Fix "Allowed memory size exhausted" in PHP

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

Fix "Call to undefined function" in PHP

PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/db.php:5

Fix "Cannot modify header information - headers already sent" in PHP

Warning: Cannot modify header information - headers already sent by (output started at…

Fix "Cannot redeclare function" in PHP

PHP Fatal error: Cannot redeclare my_helper() (previously declared in /var/www/html/inc/helpers.php:10) in…

Fix "Class not found" in PHP

PHP Fatal error: Uncaught Error: Class "App\Http\Controllers\UserController" not found in…

Fix "Creation of dynamic property is deprecated" in PHP 8.2

Deprecated: Creation of dynamic property App\Models\User::$fullName is deprecated in…

Fix "Failed to open stream: No such file or directory" in PHP

Warning: require(config.php): Failed to open stream: No such file or directory in /var/www/html/index.php on…

Fix "Maximum execution time of 30 seconds exceeded" in PHP

PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/html/index.php on line 87

Fix "Uncaught TypeError" in PHP 8

PHP Fatal error: Uncaught TypeError: calculateTotal(): Argument #1 ($items) must be of type array, null…

Fix "Warning: Undefined array key" in PHP 8

Warning: Undefined array key "id" in /var/www/html/edit.php on line 8

Fix "syntax error, unexpected end of file" in PHP

PHP Parse error: syntax error, unexpected end of file in /var/www/html/functions.php on line 214

Fix "syntax error, unexpected token" in PHP

PHP Parse error: syntax error, unexpected token "}", expecting ";" in /var/www/html/index.php on line 15

Fix PHP "Failed to open stream: Permission denied"

Warning: fopen(/var/www/html/storage/cache/data.json): Failed to open stream: Permission denied in…

How to fix "Array to string conversion" in PHP

Warning: Array to string conversion in /home/user/public_html/checkout.php on line 64

How to fix "Call to a member function on null" in PHP

PHP Fatal error: Uncaught Error: Call to a member function get_id() on null in…

How to fix "Call to undefined function mysql_connect()"

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in…

How to fix "Cannot declare class, because the name is already in use"

Fatal error: Cannot declare class PHPMailer, because the name is already in use in…

How to fix "Cannot use object of type stdClass as array"

Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /home/user/public_html/api.php:23

How to fix "DivisionByZeroError: Division by zero" in PHP

Fatal error: Uncaught DivisionByZeroError: Division by zero in /home/user/public_html/report.php:57

How to fix "Non-static method cannot be called statically" in PHP

Fatal error: Uncaught Error: Non-static method App\Helpers\Formatter::price() cannot be called statically in…

How to fix "Object of class X could not be converted to string"

Fatal error: Uncaught Error: Object of class WP_Error could not be converted to string in…

How to fix "Optional parameter declared before required" in PHP

Deprecated: Optional parameter $limit declared before required parameter $type is implicitly treated as a…

How to fix "PDOException: could not find driver" in PHP

PHP Fatal error: Uncaught PDOException: could not find driver in /home/user/public_html/src/Database.php:15

How to fix "POST Content-Length exceeds the limit" in PHP

PHP Warning: PHP Request Startup: POST Content-Length of 73400320 bytes exceeds the limit of 8388608 bytes…

How to fix "Return value must be of type X, Y returned" in PHP

Fatal error: Uncaught TypeError: App\Repository\UserRepository::findByEmail(): Return value must be of type…

How to fix "The uploaded file exceeds upload_max_filesize"

The uploaded file exceeds the upload_max_filesize directive in php.ini.

How to fix "Too few arguments to function" in PHP

Fatal error: Uncaught ArgumentCountError: Too few arguments to function App\Mailer::send(), 1 passed in…

How to fix "Trying to access array offset on value of type null"

Warning: Trying to access array offset on value of type null in /home/user/public_html/wp-content/plugins/myp…

How to fix "TypeError: Argument must be of type" in PHP

PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null…

How to fix "Typed property must not be accessed before initialization"

Fatal error: Uncaught Error: Typed property App\Services\Mailer::$client must not be accessed before…

How to fix "Unsupported operand types" in PHP 8

Fatal error: Uncaught TypeError: Unsupported operand types: string + int in /home/user/public_html/cart.php:38

How to fix "Warning: Undefined variable" in PHP

Warning: Undefined variable $total in /home/user/public_html/cart.php on line 37

How to fix "session_start(): Failed to read session data"

Warning: session_start(): open(/var/lib/php/sessions/sess_k3j2h1g0f9e8d7c6b5a4, O_RDWR) failed: Permission…

How to fix "session_start(): Session cannot be started" in PHP

Warning: session_start(): Session cannot be started after headers have already been sent in…

Security & SSL

WordPress

Fix "Briefly unavailable for scheduled maintenance" in WordPress

Briefly unavailable for scheduled maintenance. Check back in a minute.

Fix "ERR_TOO_MANY_REDIRECTS" on a WordPress site

This page isn't working. example.com redirected you too many times. ERR_TOO_MANY_REDIRECTS

Fix "Error establishing a database connection" in WordPress

Error establishing a database connection

Fix "The REST API encountered an unexpected result" in WordPress

The REST API encountered an unexpected result

Fix "The uploaded file exceeds the upload_max_filesize directive" in WordPress

The uploaded file exceeds the upload_max_filesize directive in php.ini.

Fix "There has been a critical error on this website" in WordPress

There has been a critical error on this website. Please check your site admin email inbox for instructions.

Fix the WordPress White Screen of Death

WordPress shows a blank white page with no error message (HTTP 500)

Fix the WordPress memory limit error

Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 2348617 bytes) in…

How to fix "Are you sure you want to do this?" in WordPress

Are you sure you want to do this? Please try again.

How to fix "Cookies are blocked or not supported by your browser"

Error: Cookies are blocked or not supported by your browser. You must enable cookies to use WordPress.

How to fix "Destination folder already exists" in WordPress

Destination folder already exists. /home/user/public_html/wp-content/plugins/contact-form-7/ Plugin…

How to fix "Failed to write file to disk" in WordPress

Failed to write file to disk.

How to fix "HTTP error" when uploading images in WordPress

HTTP error.

How to fix "Installation failed: Could not create directory"

Installation failed: Could not create directory.

How to fix "Missing a temporary folder" in WordPress

Missing a temporary folder.

How to fix "Sorry, you are not allowed to access this page"

Sorry, you are not allowed to access this page.

How to fix "Sorry, you are not allowed to upload this file type"

Sorry, you are not allowed to upload this file type.

How to fix "The link you followed has expired" in WordPress

The link you followed has expired. Please try again.

How to fix "The response is not a valid JSON response" in WordPress

Publishing failed. The response is not a valid JSON response.

How to fix "Updating failed" in the WordPress block editor

Updating failed. You are probably offline.

How to fix "Your site could not complete a loopback request"

Your site could not complete a loopback request. Loopback requests are used to run scheduled events, and are…

How to fix WooCommerce "Sorry, your session has expired"

Sorry, your session has expired. Return to shop

How to fix WordPress "Another update is currently in progress"

Another update is currently in progress.

How to fix WordPress 404 on all pages except the homepage

404 Not Found on every page except the homepage (WordPress permalinks)

How to fix WordPress cron not running (missed schedule)

Missed schedule

How to fix WordPress posts and pages returning 404

Not Found The requested URL /sample-page/ was not found on this server. Apache/2.4.58 (Ubuntu) Server at…

How to fix cURL error 28 in WordPress Site Health (REST/loopback)

The REST API request failed due to an error. Error: cURL error 28: Operation timed out after 10001…

How to fix mixed content warnings after adding SSL to WordPress

Mixed Content: The page at 'https://example.com/' was loaded over HTTPS, but requested an insecure image…

How to fix the WordPress login redirect loop

(After entering the correct username and password, wp-login.php reloads and asks you to log in again.)

How to fix the WordPress wp-admin login redirect loop

wp-admin login redirect loop (wp-login.php?redirect_to=...&reauth=1)