How to Fix Failed to Open Stream Error in WordPress

When WordPress.Org releases a new update to it’s WordPress standalone CMS (Content Management System) for that you may have set your website to get your installation updated automatically or you may like to do it your self at your preferred time.

But because of server load on part of your web host, you may get an error ‘failed to open the stream’ on the screen.

This error usually points out the location of the scripts where the error has occurred. In this guide, I will show you how to easily fix the WordPress failed to open stream error.

But before digging deep, let me clear the basic knowledge about this error.

This error occurs when WordPress is unable to load the file mentioned in website code. When this error occurs, sometimes WordPress will continue loading the site and only show a warning message, while 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.

Usually, the message will look like this:

Warning: require(/nfs/domains/your-domain-name.com/html/wp-includes/session.php) [function.require]: failed to open stream: No such file or directory in /nfs/domains/your-domain-name.com/html/wp-settings.php on line 122

Fatal error: require() [function.require]: Failed opening required '/nfs/domains/your-domain-name.com/html/wp-includes/session.php' (include_path='.:/usr/local/php-5.3.27/share/pear') in /nfs/domains/your-domain-name.com/html/wp-settings.php on line 122

There are different reasons that cause this error. In each instance, failed to open stream phrase would be followed by a reason. For example, permission denied, no such file or directory, the operation failed, and more.

But when your error message contains ‘no such file or directory’, then,

  • Look in the code to figure out which file is mentioned at that particular line.
  • If it is a plugin or theme file, then this means that the plugin or theme files were either deleted or not installed correctly.
  • Simply deactivate and reinstall the theme/plugin to fix the error.

Another cause includes that the WordPress is not able to locate the files because of a missing .htaccess file in your root folder.

Permalinks settings in WordPress
Permalinks settings in WordPress

  • Go to Settings » Permalinks page in your WordPress admin.
  • Click on the ‘Save changes’ button to regenerate the .htaccess file.

In case, the error message shows Permission denied, it suggests WordPress does not have the right permission to access the file or directory referenced in the code.

Check WordPress files and directory permissions and correct them if needed.

Download fresh WordPress file from the official site. Delete existing core files from your server directory except for the wp-config.php file and /wp-content/ directory. and upload freshly downloaded files to the server. This will replace all the core files without affecting your site settings and customization.

Conclusion:

Following the above steps, your website will start to function as normal as before. What else you tried, let me know in the comment section below.

ALSO READ

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Comment Policy: Your words are your own, so be nice and helpful if you can. Please, only use your real name and limit the amount of links submitted in your comment. We accept clean XHTML in comments, but don't overdo it please.

2 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

GET STARTED

Start WordPress Blog: Ultimate Guide For Beginners

Here is our step by step guide for beginners to start a WordPress blog.

Top 6 Best WordPress Theme Frameworks

There are many websites themes which are created by using a framework. Likewise, WordPress Theme frameworks also becoming so popular. The framework allows you...

The Most Essential WordPress Plugins

Here, I have listed some excellent plugins which will surely add more features and new functionality to your WordPress blog.

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

The Ultimate Guide to Harden WordPress Security

Learn how to improve WordPress security. Here are some basic security concepts that will help you to harden WordPress security.

How to Setup CloudFlare Free SSL for WordPress Blog

Google has announced that they will count HTTPS as a ranking factor which means if you using HTTPS you will get a higher position...

DEALS

WP Rocket

Get 30% discount on WP Rocket plugin Now!

POPULAR NOW

How to Remove jQuery Migrate in WordPress?

jQuery Migrate greatly simplifies the process of moving older jQuery code to a higher jQuery version by identifying deprecated features. It then restores deprecated...

Get almost 100% PageSpeed on Newspaper theme

The newspaper theme is the most popular premium theme for a self-hosted WordPress blog. The theme is developed by team tagDiv. You...

How to Delete Multiple Images in WordPress Media Gallery

Hey, guys today one of my friends asked me a question, How can I delete Multiple Images in WordPress? I replied, "It's very simple." Yeah,...

Xperia Home Launcher: Install on any Android Device (No Root)

Hey, guys today through this tutorial you are going to learn how to install Xperia Home Launcher on any Android device without any root. Also...

Tips to Speed Up WordPress Performance

Here, I am sharing some tips to speed up WordPress performance. All you need to modify .htaccess file on your server and add some plugins.

How to Display Featured Image Before or After Entry Title in Genesis

Learn how to add featured image to a single post or a page in Genesis child themes. You can set it to display featured...