The ‘failed to open stream' error is a standard error that points to the location where the error occurred and can be quite tricky for beginners to understand it. However, before we address how to fix it, we first must understand what causes it and the source.
In this article, we shall cover the causes of Open stream error in WordPress and how to fix it.
Open Error Stream Error Causes
The error is caused whenever WordPress is unable to load the file that is mentioned in the code. After the error occurs, WordPress may continue loading and show a warning or show a fatal error and refuse to load anything else. Fortunately, due to the message phrasing, you might have clues as to where the error occurred in the code and the most likely reason why.
The message may look like the following:
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
How to Fix the WordPress Failed to Open Stream Error
Due to the many reasons that may be behind the error, there are quite some ways that we can fix the error. Some of the reasons for the failure may be listed as; permission denied, no such directory or operation failed.
No Such file or Directory
If your reason is for instance ‘no such file or directory', that means you need to look at the code to figure out which file is mentioned in error. If a plugin or a theme is said, then that means that it was probably deleted or not installed correctly, reinstall it and see if it fixes the problem.
However, the problem may be as a result of a missing htaccess file. You may go to your WordPress site, click settings, then permalinks and hit the save changes button to recreate the htaccess file.
Permission denied error.
If the error message is about permission, e.g. permission denied. Your WordPress site does not have sufficient rights to access the file shown in the error code. To fix this particular type of error, you need to connect to your WordPress site using an FTP client (I am using WinSCP). Go to the root folder of your site and select all folders. Right-click the selected files and select properties.
You need to make sure that in the numeric value field, you have the number 755. Make sure that for owner permissions, the read, write and execute checkboxes are checked. For the group permissions and public permissions only the write checkbox should be unchecked.
Select the all the files root folders included. And click properties.
Leave the numeric value field only. Make sure that under the owner permissions the read and write checkboxes are checked. As for the group and public permissions only the read checkbox should be checked.
Click OK to continue, and your chosen FTP client will begin to set file permissions to the selected files on your WordPress site.
Some plugins load scripts from sources such as google analytics and google maps while some may require authentication and a particular procedure to access them. Failure to follow the instructions given for using them may result in your WordPress site not opening the files needed hence the error.
Remember that WordPress is a free and open source project and some of the many themes provided. It means that some plugin developers are not on the official WordPress team (not employed by WordPress). The plugins they create are for their personal use and lack proper testing to ensure seamless integration with your WordPress site. For these developers, you may get charged for the extra support that you may require.
Since some plugins don't have support, you can look for help in the support forums. Just go to your plugins page and click on the plugin that’s causing the error then click FAQ for the plugins that don’t have the support button. The FAQ page shows you many questions that have been asked by users around the world. Chances are you will see your issue listed among the questions and the most likely solution.
WordPress is an excellent tool for communication, and you shouldn't have to worry about it Open stream error. Steps above will guide you how to fix the error whenever you encounter it.