Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In WordPress Last updated: May 19, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

Are you a WordPress site owner annoyed with the “Failed to Open No Such File or Directory ” error message? This is a typical issue that can arise from diverse factors and can lead to the malfunctioning or inaccessibility of your site.

To fix this error, it is crucial to determine the underlying cause of the error from the root. Then you need to implement the necessary measures to address it. The process can prove to be challenging, particularly for individuals who don’t know how to fix it. 

Luckily, you don’t need to have any technical expertise to resolve this issue. In this article, we will guide you through the process of identifying the cause of the “Failed to Open Stream No Such File or Directory” error. Also, we will provide step-by-step instructions for troubleshooting the error.

So, let’s dive in and solve this frustrating error once and for all!

Common Reasons Behind Failed to Open Stream Error


Generally, the “Failed to Open Stream” error message is triggered when WordPress cannot locate a file or directory. These files or directories are required to perform a certain function or load a specific page on your website.

The “Failed to Open Stream” error in WordPress can manifest in different ways. For example, it can show a warning message that appears while the page continues to load. Also, it can show a fatal error that prevents the page from loading altogether. 

There are some typical causes of this error, and the message clarifies the reason behind the error and how you can fix it. The message may indicate the following issues: 

  • No such file in the directory 
  • Permission denied
  • Operation failed

Depending on the underlying reason for the error, the message’s precise language may change. But it is crucial to pay attention to it since it might point you in the direction of the issue.  Thus, you can take the necessary actions to address the “Fail to Open Stream” error and restore your WordPress website’s functionality. 

Let’s get a closer look at the common reasons behind Failed to Open Stream error:

Incorrect file permission

Permission on incorrect files can prevent WordPress from gaining access to necessary files or directories. When the server lacks the necessary permission to read, write, or execute a file or directory, WordPress will be unable to access it. Then, the Failed to Open Stream error appears on the site. 

For instance, WordPress won’t be able to alter a file if it is set to read-only on the server, which would result in an error. Moreover, WordPress will be unable to navigate a directory and access the files within it if it is not executable, which would result in the same issue. 

Wrong file path 

An erroneous or nonexistent file path is another frequent reason for the “Failed to Open Stream” error in WordPress. The error will appear if the file path supplied in the WordPress code is wrong or leads to a directory or file that doesn’t exist.

This will occur if the developer mistypes a directory name or uses an incorrect file extension while creating the file path. Alternatively, if the file or directory has been moved, destroyed, or otherwise altered, the file path will become incorrect, and the issue will manifest.

Missing Required Files 

Missing files can be another reason behind the “Failed to Open Stream” error in WordPress. WordPress encounters an error when the file or directory it is attempting to access is missing. 

This can happen when a file or directory is removed during an update, mistakenly deleted, or transferred to a new location. This issue can sometimes be bought on by a plugin or theme update that also deletes a file or directory required by WordPress. 

Erroneous WordPress Installation 

The “Failed to Open Stream” error can also occur If the WordPress installation files are corrupted or include errors. Also, a corrupt installation can occur as a result of various factors, including improper installation, absence of required files, or presence of corrupted files.  

In certain instances, the installation files may have undergone alterations, deletions, or corruption as a result of server errors, malware, or viruses. Plus,  making any mistake while trying to modify the WordPress core files can also lead to faulty installation.  

Conflicts With Plugin or Theme 

Sometimes, conflicting with the installed theme or plugin can create the “Failed to Open Stream ” error in WordPress. Incompatibility between the code in a plugin or theme and WordPress or other plugins may result in conflicts. Thus, It hinders WordPress from accessing the necessary files or directories, and the error occurs.  

Generally, incompatibility issues arise when a plugin or theme includes a function or code that isn’t supported by WordPress or other plugins. So, the conflict ultimately results in an error. Also, it’s possible that a plugin or theme installed on your site is conflicting with another plugin or theme, emerging with the same error.  

Bad Server Configuration

The occurrence of the “Failed to Open Stream” error can also be related to the server configuration issue. Since a server is responsible for hosting a site and making it available on the internet, any misconfiguration can lead to an error. 

A typical reason for server configuration issues is the absence or inaccuracy of a setting that prevents WordPress from gaining access to a file or folder. Let’s say a server is configured in such a way that will not allow WordPress to write the file system. In such instances, WordPress won’t be able to create or modify files or directories, leading to the error. 

Another potential cause of server configuration issues is security settings that block WordPress from gaining access to a file or directory. The server’s configuration may limit access to specific directories or files to prevent unauthorized access. As a result, the “Failed to Open Stream” error appears. 

Now you are aware of the common root causes behind the  “Failed to Open Stream No Such File or Directory” Error. Let’s move forward and focus on how you can solve this error to regain the effectiveness of your site.

Ways to Fix “Failed to Open Stream No Such File


Before taking any steps, you just need to read the error message carefully to understand the root cause. Because the message indicates the error along with the underlying reason behind it. WordPress users mostly rely on a plugin to resolve any issue, which is not required in this case. 

The “Failed To Open Stream” error can produce severe performance issues in your WordPress site. But if you aren’t comfortable making changes, contact a developer or your hosting provider. 

Here are the processes that you can follow to resolve issues that can cause the “Failed To Open Stream” error: 

Fixing No Such File Or Directory

Follow these steps if the “Failed To Open Stream” error occurs due to “No such File or Directory”: 

Action Based On Error Message 

Find the script and see what file or directory it is attempting to access. Then Check your spelling. If that’s accurate, it may mean that it was removed.

Let’s say you are getting the following error message on your WordPress site: 

Warning: require(/home/username/public_html/wp-content/plugins/my-plugin/my-file.php): failed to open stream: No such file or directory in /home/username/public_html/wp-content/plugins/my-plugin/my-plugin.php on line 25

In this example, WordPress is attempting to access a file located at “/home/username/public_html/wp-content/plugins/my-plugin/my-file.php”, but it cannot be found. 

The error message specifically states “failed to open stream: No such file or directory”, indicating that the file path is incorrect or the file does not exist. The error is occurring in the “my-plugin.php” file on line 20.

Deactivate and Activate plugin

You can simply reinstall the plugin or deactivate and activate it again to resolve the error. 

By updating your WordPress site’s permalink, you can resolve various URL structure-related issues. For example:  “Failed To Open Stream: No Such File In the directory”, “404 not found error.” The steps to change the permalinks on your WordPress website are as follows: 

  1. First, log into your WordPress site’s admin dashboard 

2. Now, click on Settings and then select the Permalink option.

Save changes in Permalink

3. On the Permalinks settings page, you don’t need to make any changes to the settings. Simply click on the “Save Changes” button at the bottom of the page.

4. Click Save Changes, and that’s all. 

By saving changes, WordPress will update the .htaccess file, which is in charge of controlling the permalinks of your website. This may assist in resolving any permalink-related issues which were causing the error. If the “Failed to Open Stream” error is still appearing, let’s continue reading to get more solutions. 

Create The Missing .htaccess file  

The missing .htaccess file can also be the cause of the “Failed to Open Stream No Such File or Directory” problem in WordPress. Don’t worry if your website does not automatically produce the .htaccess file. However, you can simply do it by following these instructions: 

  1. Log in to your cPanel and go to File Manager
C Panel File Manager

2. Now click on the public_html folder and click the Settings wheel in the top right corner. Since the .htaccess file is hidden by default, you need to 

Show .htaccess file

3. If the file is not available, it will cause the “Failed to Open Stream No Such File or Directory” error. So, create one by clicking the File button on the top left corner and clicking Create the file.

Create .htaccess file

4. Right-click the .htacces file and click edit and put the following codes. Lastly, click save changes.  

# BEGIN WordPress

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteBase /

RewriteRule ^index\.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]


# END WordPress

Resolving Permission Denied Issue

WordPress is unable to access the file or directory specified in the code when the “Permission denied” message is shown. So, to resolve this issue, you should check out the WordPress file and directory permission and then fix it. 

Permission Denied Issue

Usually, it’s common to implement variations in permissions for specific files. It allows site owners to control the access of designated users in specific files. Changing the permission settings can fix the “Failed to Open Stream” error. However, follow the below processes to resolve the permission denied issue: 

  1. First, log in to the cPanel of your website and Click File Manager 

2. Then click the Public_html folder.

3. Now, click ctrl and left-click wp-admin, wp-content, and wp-includes folders and then right-click the permission option. 

Change Permission in WordPress folders

4. Now change the permission value to 755. 

Changing FIle permission 644 in WordPress files

5. For the rest of the files, change the value to 644

Fixing Plugin Issues 

Certain plugins are dependent on scripts obtained from external sources, such as Google APIs.Thus,  Improper configuration can result in issues with authentication and access. To prevent such problems, it is recommended to verify that the plugin has been configured accurately. 

Installed Plugins in WordPress

It should be noted that some contributors of WordPress themes may not be recognized as official developers of WordPress. As a result, those plugins can lack detailed testing and won’t seamlessly integrate with WordPress. If encountering such issues, it is recommended to contact the developer for assistance. However, keep in mind that additional support may come at a cost.

You can also peruse support forums to obtain useful insights and recommendations for addressing plugin errors. Furthermore, accessing the plugin’s official website and reviewing its frequently asked questions section may also provide assistance. It is highly likely that others have encountered the same error before. 

Operation Failed Issue 

An inappropriate access technique or an authentication issue may be the cause of your operation failure. This error usually occurs due to a plugin that loads scripts from third-party APIs. However, to resolve this issue follow these steps: 

  1. Deactivate each plugin and then reactivate them one at a time to find the conflicting plugin. Then contact the developer of the plugin to get a solution.
  2. To rule out any theme-related issues, temporarily switch to the default WordPress theme. 
  3. Increase the PHP Memory limit, which may resolve the issue
  4. Clear the cache and cookies in your browser to get rid of any stored data that is conflicting.
  5. Reinstall WordPress core files by downloading a fresh copy of WordPress. Then overwrite the existing files with the freshly downloaded files. 
  6. Contact your site hosting company for further help if none of the aforementioned fixes work.

Re-install WordPress Manually 

Manual installation of WordPress can also fix any damaged file or file path error that is causing the “Failed To Open Stream” error. Follow these steps:

  1. Visit and download the most recent version of WordPress. 
  2. When the download is finished, extract the Zip file’s content 
  3. Use FTP or cPanel to access the file management for your hosting account.
  4. Keep the wp-content and wp-config.php files intact and delete all other files and directories. You should do it from your WordPress installation in the file manager. 
  5. After extracting the downloaded zip file, upload all the files and folders from it. 

Final Thoughts

WordPress users can sometimes suffer from different kinds of issues, like the infamous “Failed To Open Stream” error. The user experience may suffer if they encounter an error message, regardless of the source. Therefore, you must have effective solutions in hand to keep your site running effectively.

We’ve mentioned the easiest ways to resolve the “Failed to Open Stream” error. Hopefully, you can easily apply the changes and restore the site back in action after going through this guide. Also, you should educate yourself on common WordPress errors so that you can diagnose and resolve them right away.

You may also explore how to fix memory limit error and keep the WordPress site going.

  • Atanu Das
    Atanu Das is a professional content writer with experience writing SEO-optimized creative content in different niches. He is actively writing effective content for tech companies to expand their business to the next level. He has completed… read more
Thanks to our Sponsors
More great readings on WordPress
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder