Are you seeing the ‘failed to open stream’ error in WordPress?
This error message usually points to the location of the scripts where the error has occurred. However, it can be quite difficult for beginner users to understand it.
In this article, we will show you how to easily fix the WordPress ‘failed to open stream’ error.
What Causes the ‘Failed to Open Stream’ Error in WordPress?
The ‘failed to open stream’ error occurs when WordPress.org is unable to load a file or resource mentioned in the website’s code.
When this happens, sometimes WordPress will continue loading your website and only show a warning message in the place where the error occurs. Other times, WordPress will show a fatal error and will not load anything else.
The message phrasing will be different depending on where the error occurs in the code and the reason for failure. It will also give you clues about what needs to be fixed.
Typically, this message will look something like this:
Warning: require(/home/website/wp-includes/load.php): failed to open stream: No such file or directory in /home/website/wp-settings.php on line 19
Fatal error: require(): Failed opening required ‘/home/website/wp-includes/load.php’ (include_path=’.:/usr/share/php/:/usr/share/php5/’) in /home/website/wp-settings.php on line 19
Here is another example:
Last Error: 2023-04-04 14:52:13: (2) HTTP Error: Unable to connect: ‘fopen(compress.zlib://https://www.googleapis.com/analytics/v3/management/accounts/~all
/webproperties/~all/profiles?start-index=1): failed to open stream: operation failed’
Having said that, let’s take a look at how to troubleshoot and fix the ‘failed to open stream’ error in your WordPress website based on the error message. You can use these quick links to skip to a specific section:
How to Fix ‘No Such File or Directory’ Error Message
If the error message contains ‘no such file or directory,’ then you need to look in the code to figure out which file is mentioned on that particular line.
If it is a media file, then you can try reuploading it to the media library.
If it is a plugin or theme file, then this means that the plugin or theme files were either deleted or not installed correctly.
You will simply need to deactivate and reinstall the theme or plugin in question to fix the error. If it is a plugin, please see our guides on how to deactivate WordPress plugins and how to install a WordPress plugin.
You can also read our guide on how to deactivate WordPress plugins when you’re unable to access wp-admin if you cannot log in to WordPress.
If it is a theme, please see our guides on how to delete a WordPress theme and how to install a WordPress theme.
However, WordPress may also be unable to locate the files because of a missing .htaccess file in your root folder.
In this case, you need to go to the Settings » Permalinks page in your WordPress site admin and just click on the ‘Save Changes’ button to regenerate the .htaccess file.
How to Fix ‘Permission Denied’ Error Message
If the error message is followed by ‘permission denied,’ then this means that WordPress does not have the right permission to access the file or directory referenced in the code.
To fix this, you need to check WordPress files and directory permissions and correct them if needed. You may also want to see if your temporary folder is missing and if it’s causing this error.
How to Fix ‘Operation Failed’ Error Message
Finally, some WordPress plugins load scripts from third-party sources like Google Analytics, Facebook APIs, Google Maps, and more.
Some of these third-party APIs may require authentication or might have changed the way developers can access them. A failure to authenticate or an incorrect access method will result in WordPress failing to open the required files.
To fix this, you will need to contact the plugin author for support. They should be able to help you fix the error.
Other Ways to Fix WordPress ‘Failed to Open Stream Error’
If none of these tips help you resolve the issue, then you can try a few additional methods.
At times, loading files that exceed the available memory can lead to the ‘failed to open stream’ error. You can try increasing the PHP memory limit in your wp-config.php file to see if it solves the problem.
Occasionally, a plugin or theme can conflict with WordPress core files and cause this error. To troubleshoot, temporarily deactivate all plugins and switch to a default theme like Twenty Twenty-Four.
If the error disappears, then you can start reactivating plugins one by one to pinpoint the culprit.
Additionally, try using WordPress debug mode and error logs to gather more information about the error and pinpoint the location in the code where it occurs.
In rare cases, corrupted WordPress core files themselves might be causing the error. If you’ve tried all the previous solutions and the error persists, consider reinstalling your WordPress software.
You can also read our WordPress troubleshooting guide. This step-by-step guide will help you pinpoint the issue and easily find the solution.
Get Your Site Back on Track With These Guides
The ‘failed to open stream’ error is just one hurdle you might face on your WordPress journey. Here are some helpful guides to address other common WordPress errors:
- How to Fix the WordPress White Screen of Death (Step by Step)
- How to Fix the 500 Internal Server Error in WordPress
- How to Fix the Error Establishing a Database Connection in WordPress
- How to Fix WordPress Posts Returning 404 Error (Step by Step)
- How to Fix the HTTP Image Upload Error in WordPress
We hope this article helped you fix the WordPress ‘failed to open stream’ error. You may also want to bookmark our list of the most common WordPress errors and our guide on how to fix the critical error in WordPress.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Jiří Vaněk
I would also like to add that sometimes some FTP clients change the size of letters from uppercase to lowercase or vice versa. Linux machines are case sensitive. That is, the file may actually be there, but it may have different capital letters, and for Linux it is already a different file than what it is looking for.
milad
thank you it was so helpful
WPBeginner Support
Glad to hear our guide was helpful!
Admin
mukesh
when i open error file in file manager then show error:-
PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
PHP Fatal error: Unknown: Failed opening required ‘/home/printwow/public_html/site/index.php’
(include_path=’.:/opt/alt/php54/usr/share/pear:/opt/alt/php54/usr/share/php’) in Unknown on line 0
please help
WPBeginner Support
For a permissions error, you would want to take a look at our article here: https://www.wpbeginner.com/beginners-guide/how-to-fix-file-and-folder-permissions-error-in-wordpress/
Admin
Ong
Please Help Me
[15-Jun-2019 07:05:54 UTC] PHP Fatal error: require(): Failed opening required ‘/public_html/CMS/wp-includes/post-thumbnail-template.php’ (include_path=’.:/opt/alt/php70/usr/share/pear’) in /public_html/CMS/wp-settings.php on line 175
WPBeginner Support
For that error, you would want to first try updating your WordPress using FTP: https://www.wpbeginner.com/beginners-guide/ultimate-guide-to-upgrade-wordpress-for-beginners-infograph/
Admin
Tamsyn
All this is well and good – but what if you can’t even get into your dashboard/admin space?
WPBeginner Support
You could try the steps in our article here: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Christina
Please help! I can’t even log into my site to try the suggestions in this article!
WPBeginner Support
If you’re unable to log in you could try the recommendations in our article here: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Estefania B
Please help:
Fatal error: require(): Failed opening required ‘/home/content/01/14040901/html/wp-blog-header.php’ (include_path=’.:/usr/local/php5_6/lib/php’) in /home/content/01/14040901/html/index.php on line 30
how do i fix it? and what could be the probable cause of it?
WPBeginner Support
For fixing that issue, you would want to go through the troubleshooting steps in our article:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
to find the culprit
Admin
Sikander Azam
Please help me :
Fatal error: require(): Failed opening required ‘/wp-includes/post.php’ (include_path=’.:/opt/cpanel/ea-php56/root/usr/share/pear’) in /public_html/wp-settings.php on line 178
WPBeginner Support
If the method in this article was not able to assist you, we would recommend going through our troubleshooting steps here: https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Harsh
*Please Help*
Fatal error: require_once(): Failed opening required ‘/public_html/wp-content/plugins/amp/includes/widgets/class-amp-widget-media-video.php’ (include_path=’.:/opt/php56/lib/php’)
What do i do? I am not able to access my dashboard as well my site
WPBeginner Support
It looks like your AMP plugin is having trouble, you should be able to deactivate it using: https://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/
to be able to log back into the site.
Admin
Qumber Rizvi
Three of my WP sites are hosted on the same hosting. All of them are giving the same error:
Warning: require(/home/selfsbsr/public_html/pulse/wp-includes/post.php): failed to open stream: Permission denied in /home/selfsbsr/public_html/pulse/wp-settings.php on line 166
Warning: require(/home/selfsbsr/public_html/pulse/wp-includes/post.php): failed to open stream: Permission denied in /home/selfsbsr/public_html/pulse/wp-settings.php on line 166
Fatal error: require(): Failed opening required ‘/home/selfsbsr/public_html/pulse/wp-includes/post.php’ (include_path=’.:/opt/alt/php56/usr/share/pear:/opt/alt/php56/usr/share/php’) in /home/selfsbsr/public_html/pulse/wp-settings.php on line 166
Note that these three sites are single sites and NOT part of Multisite Network. They do NOT share databases or directories.
All they have in common is the host.
I’ve tried to resolve this by resetting permissions of all the files and directories, disabling plugins by renaming folders of each of em, disabling theme by renaming its folder. I’ve checked the htaccess file. Nothing is out of the ordinary. And yet, I can’t do anything bring it back up.
What should be the probable cause?
WPBeginner Support
Hi Qumber,
Please contact your hosting provider. It seems like a hosting issue.
Admin