thumb

Have you recently updated any WordPress plugin, but it was automatically deactivated? Then chances you now getting the following error message (an example):

Warning: fopen(/home/public_html/site/wp-content/plugins/header-and-footer-scripts-inserter/header-and-footer-scripts-inserter.php): failed to open stream: No such file or directory in /home/public_html/site/wp-includes/functions.php on line 4835

Warning: fread() expects parameter 1 to be resource, boolean given in /home/public_html/site/wp-includes/functions.php on line 4838

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/public_html/site/wp-includes/functions.php on line 4841

What causes this error

The error message indicates that the plugin can not be activated because the functions.php file is not found. The functions.php file is not part of the plugin, but is part of the WordPress installation. Therefore, this is not quite a problem with the plugin, but a random issue with the WordPress installation.

How to solve it

To solve this problem all you need to do is manually reinstall the plugin that mentioned in the error message. Despite the fact that there is an easy way to delete and install any plugin from the WordPress Admin Area, we can not do this either, because in this case the plugin can delete the plugin settings. For this reason, to reinstall the plugin manually (by simply overriding all files via FTP or SFTP), please perform the following steps.

As an example, I will use the “Head and Footer Scripts Inserter” plugin, but in your case there can be any other plugin (see the error message that you received to find out the name of the plugin).

  1. Download a copy of the plugin from the official website of the plugin to your computer. Select the latest version of the plugin. After downloading you should have a ZIP archive called header-and-footer-scripts-inserter.1.0.zip. This is a compressed file containing all the folders and files required for the plugin to function properly.
  2. Unzip the ZIP archive on your computer. You’ll get the folder header-and-footer-scripts-inserter.

    You need to preserve the directory structure in the archive when extracting these files.

  3. Access your server via FTP or SFTP.

    If you aren’t sure how usually your web hosting provider will have instructions somewhere on their website.

  4. Browse to the directory wp-content/plugins/.

    Please contact your web hosting company to get help if you can’t find this folder.

  5. Upload the plugin folder header-and-footer-scripts-inserter from step 2, with replacing the current folder of the plugin. Wait for the uploading to complete, it may take several minutes. Once the upload complete, the plugin should be in wp-content/plugins/header-and-footer-scripts-inserter/ on your server.

    Important! Sometimes files are deleted inside the plugin folder so make sure that your program is deleting all files and uploading the new ones when it overrides instead of simply “updating newer files”. It can cause issues if you have files on your server inside the plugin folder that are no longer used in the plugin itself.

  6. Log in to Admin Area of your WordPress website.
  7. Go to the Plugins -> Installed Plugins.
  8. Find the plugin in the list of installed plugins and click the Activate button below. Now the plugin should activate without errors.

Note! After you are done reinstalling a plugin please also clear your website and browser cache to prevent errors.

Conclusion

And that’s all. You’re now have the plugin activated without errors.


If this article helped you solve the problem then please leave a comment. :smiley:

Thanks for reading!

Arthur Gareginyan
Arthur Gareginyan

Arthur is a designer and full stack software engineer. He is the founder of SpaceX-Chimp and the blog MyCyberUniverse.com. His personal website can be found at arthurgareginyan.com.

Follow Arthur: