Warning: fread() expects parameter 1 to be resource

Warning- fread() expects parameter 1 to be resource

Error

When I was migrating my page from localhost to production server, I got this warning message:

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

The only article mentioning this issue is this one in the wordpress support thread. But the author of the plugin doesn’t address the issue. @kernel52 says you should

a) change the theme of the website
b) disable and re-enable the plugin
c) then switch back to the theme you were using

but that doesn’t worked for me.

Solution

After more investigation I have found the code in functions.php that was causing the issue. I think it’s because of the freemium feature. What worked for me is:

1. change $__DIR variable on line 26

// $__DIR = dirname( __FILE__ );
$__DIR = plugin_dir_path( __FILE__ );

2. comment out the freemium feature on line 71:

require_once $__DIR . '/analytics/initialize.php';
// require_once $__DIR . '/analytics/initialize.php';

3. navigate from the plugins page somewhere else. (don’t test it while you are in plugins page).

And that’s it. Hope it helped.

Related Post

FREE ePub Quicklook and Spotlight Plugins for Mac ... When you have a lot of ePub books, it can be useful to see excerpt and meta data information in quicklook. Even more important...
PPTP VPN on MAC OS X Sierra, High Sierra and Mojav... PPTP VPN for Mac OS X Introduction PPTP VPN is no longer supported on macOS Sierra and High Sierra and that is just fine, because there are some se...
Right-Click to Translate (Look Up) with Google Tra... If you are not native english speaker, you may be frustrated with default "look up" options you get after selecting a text and right clicking. There a...
Translate Selected Text to English on Right Click ... TL;DR; Need instant translation right in context menu? You can accomplish it for free with one line of code in Automator, or you can proc...
Right Click to Create New File on Mac OS X TL;DR; Windows has a lot of cons but it has also some pros. One of them is a smooth way to create empty file on right-click. Mac OS doesn't come with...
MacBook wifi issue – OS X keeps reconnecting Last few weeks I was facing annoying wifi problems. My mac was reconnecting every 5 minutes. On top of that BSSID was reseting so I saw BSSID changing...
Buy me a coffeeOut of coffee 😱, please help!