Website support, maintenance and fixes for UK businessesCall 0208 088 8371info@websupportservices.co.uk

HomeWordPress errorsFix the WordPress Failed to Open Stream Error

Fix the WordPress Failed to Open Stream Error

The WordPress "Failed to open stream: No such file or directory" warning means PHP has been told to load a file that it cannot find at the expected location. The path shown in the error is usually the most useful clue.

The message you might see

Warning: require(): Failed to open stream: No such file or directory

Different wording, or a file path in the message? Paste it into our free error finder to see which plugin or theme it comes from.

What the failed to open stream error means

WordPress, themes and plugins use PHP functions such as require(), require_once() and include() to load other PHP files. A failed to open stream warning appears when PHP follows one of those instructions but the target file is missing, inaccessible or referenced using the wrong path.

Read the complete error rather than only the first line. It will often contain the file that made the request, its line number and the path PHP attempted to open. A path containing wp-content/plugins/ usually points towards a plugin problem, while a path under wp-content/themes/ suggests the active theme or a child theme.

A warning from require() may be followed by a fatal error because PHP cannot continue when a required file is unavailable. That can leave the front end, WordPress admin area or both inaccessible.

Common causes on WordPress sites

A failed plugin or theme update is a frequent cause. Part of the package may have been replaced while another required file was not copied correctly. The same problem can occur after manually moving a site, restoring an incomplete backup or uploading only part of a plugin directory.

Custom PHP can also contain an incorrect relative path. A statement such as require 'includes/file.php'; depends on the execution context, so code can work in one location and fail after files are moved. Developers commonly build predictable paths from __DIR__ instead.

Other causes include a renamed file, incorrect filename capitalisation on Linux hosting, a plugin expecting a dependency that is no longer installed, or filesystem ownership and permissions preventing PHP from reaching a file that does exist. Security software can occasionally quarantine a compromised PHP file, exposing a separate underlying security problem.

How to fix failed to open stream safely

  1. Take a full backup of the website files and database before editing, replacing or restoring anything.
  2. Copy the full error and identify the missing path. Check whether it points to WordPress core, a plugin, a theme or custom code.
  3. If the path belongs to a plugin or theme and the error started after an update, reinstall a clean current copy from its original source. Do not replace individual WordPress core files unless you know exactly why they are missing.
  4. If you cannot reach WordPress because a plugin is failing, use your hosting file manager or SFTP to rename only that plugin's directory inside wp-content/plugins. WordPress will treat the plugin as unavailable. Restore the original directory name before reinstalling or troubleshooting it further.
  5. For custom code, check the path against the real directory structure. A developer may use an absolute path based on the current file, for example:
    require __DIR__ . '/includes/example.php';
    Do not make this change blindly inside third party plugins because an update may overwrite it and the missing file may indicate a damaged installation instead.
  6. If the file exists, check ownership and permissions with your host. WordPress documents typical file permissions of 644 and directory permissions of 755 for many configurations, but the correct values depend on the server. Do not set directories to 777 as a routine workaround.

If the source is still unclear, WordPress debugging can log the call stack. On a staging copy, or briefly during controlled diagnosis, WP_DEBUG and WP_DEBUG_LOG can be configured in wp-config.php. Avoid displaying detailed PHP errors publicly on a live site.

When to stop troubleshooting and get help

Stop making changes if the missing path belongs to unfamiliar custom code, several files have disappeared, permissions appear to change by themselves, or restoring the expected file immediately produces another failure. Those symptoms need diagnosis rather than repeated file replacement.

If files have vanished without an update or deployment explaining it, consider the possibility of malware or a damaged hosting account and investigate before restoring files into the same environment. Our website security guidance explains the wider checks worth making.

Web Support Services offers an Emergency Fix for £249 per incident with a response within 2 working hours. For ongoing maintenance, care plans start from £59 a month.

Common questions

Answers to the questions we hear most about this.

Does failed to open stream mean my WordPress site has been hacked?

Not usually. Missing plugin files, incomplete updates and incorrect PHP paths are more common causes. Unexpectedly deleted or quarantined files can justify a security check, particularly if there was no recent update or deployment.

Can I fix the error by changing file permissions to 777?

No. 777 gives far broader write access than a normal WordPress installation should require and can create a security risk. Check the file owner and use permissions appropriate to your hosting configuration.

Should I edit the PHP file named in the warning?

Only if it is your own code and you understand why the path is wrong. For a third party plugin or theme, reinstalling a clean current copy is normally safer than patching vendor code.

Site down or showing an error?

Call us now. Emergency Fix is £149 with a response within 2 working hours, and no fix means no fee.

Get website support