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).
- 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.
- Unzip the ZIP archive on your computer. You’ll get the folder
You need to preserve the directory structure in the archive when extracting these files.
- 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.
- Browse to the directory
The location of the folder
wp-contentdepends on your host’s setup. Typically, the folder
public_htmlcontains all the files of the website, among which you will find this folder. Please contact your web hosting company to get help if you can’t find this folder.
- Upload the plugin folder
header-and-footer-scripts-inserterfrom 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 programme 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.
- Log in to Admin Area of your WordPress website.
- Go to the
- Find the plugin in the list of installed plugins and click the
Activatebutton 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.
That’s it, you’re done. You’re now have the plugin activated without errors. So simple isn’t it?
If you are having trouble fixing this problem with the instructions above, but are being able to solve this problem with any another method please describe it in the comment section below. Thanks!
If this article has helped you solve the problem then please leave a comment
Thanks for reading!