Title: PHP errors when adding new sites
Last modified: August 21, 2016

---

# PHP errors when adding new sites

 *  Resolved [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * (@kent-brockman)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/)
 * Hello guys, I started having this php error every time a new site is added to
   a WP multisite. It’s happenning the same as reported in this other topic:
    [http://wordpress.org/support/topic/error-when-adding-new-site?replies=5](http://wordpress.org/support/topic/error-when-adding-new-site?replies=5)
 * The server is running on PHP 5.4.29, MySQL 5.6.16, Apache 2.4.9, and there are
   less than 30 sites here. All of them works well. The sites are correctly created,
   yet this error appears, and looks like it is thrown when the resulting page try
   to be shown. I simply hit the Back button in the browser, refresh the sites screen
   and continue working.
 * This is the php error shown in screen:
 * >  Warning: fopen(/home/SITENAME/public_html/wp-content/plugins/EMPTY): failed
   > to open stream: No such file or directory in /home/SITENAME/public_html/wp-
   > includes/functions.php on line 3879
   > Warning: fread() expects parameter 1 to be resource, boolean given in /home/
   > SITENAME/public_html/wp-includes/functions.php on line 3882
   > Warning: fclose() expects parameter 1 to be resource, boolean given in /home/
   > SITENAME/public_html/wp-includes/functions.php on line 3885
   > Warning: Cannot modify header information – headers already sent by (output
   > started at /home/SITENAME/public_html/wp-includes/functions.php:3879) in /home/
   > SITENAME/public_html/wp-includes/pluggable.php on line 1121
 * (The real folder path was replaced with “SITENAME”)
 * Looks like it’s trying to open something inexistent (/home/SITENAME/public_html/
   wp-content/plugins/**EMPTY**)…
 * I tried deactivating the Plugin Manager and then I can create sites without issues.
 * What may be causing this?
    Anybody else having these issues? Any fix either?
 * Thanks!
 * [https://wordpress.org/plugins/multisite-plugin-manager/](https://wordpress.org/plugins/multisite-plugin-manager/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * (@kent-brockman)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976725)
 * OH BOY, I THINK I FOUND WHERE THE BUG IS…
 * I further investigated the error in /wp-includes/functions.php, line 3879. This
   line is inside function get_file_data() which is supposed to read the first 8Kb
   of metadata in plugins and themes, so an error here could be caused to trying
   to open an undefined or inexistent filename, or, let’s say, the function is called
   with incorrect params, or none at all.
 * >  * Retrieve metadata from a file.
   >  * * Searches for metadata in the first 8kiB
   > of a file, such as a plugin or theme. * Each piece of metadata must be on its
   > own line. Fields can not span multiple * lines, the value will get cut at the
   > end of the first line. * * If the file data is not within that first 8kiB, 
   > then the author should correct * their plugin file and move the data headers
   > to the top. * * [@see](https://wordpress.org/support/users/see/) [http://codex.wordpress.org/File_Header](http://codex.wordpress.org/File_Header)**
   > [@since](https://wordpress.org/support/users/since/) 2.9.0 * [@param](https://wordpress.org/support/users/param/)
   > string $file Path to the file * [@param](https://wordpress.org/support/users/param/)
   > array $default_headers List of headers, in the format array(‘HeaderKey’ => ‘
   > Header Name’) * [@param](https://wordpress.org/support/users/param/) string
   > $context If specified adds filter hook “extra_{$context}_headers”
 * The problem here starts when Plugin Manager is network activated. The question
   is when and from where is called the function get_file_data() with erroneous 
   params. I did a grep in the same folder and I see these scripts call the function:
   /
   wp-includes/class-wp-theme.php: to identify metadata when listing themes. /wp-
   includes/i10n.php: to identify metadata in PO translation files (.po). /wp-admin/
   includes/plugin.php: to identify metadata in plugins. /wp-admin/includes/class-
   wp-upgrader.php: to identify metadata from available updates.
 * Also, I found some other plugins are calling this function from its code:
    – 
   jetpack – backwpup (network activated) – wpmudev-updates – woocommerce
 * I tried deactivating backwpup and W3 total cache, but the issue persists. So,
   they aren’t a culprit.
 * Please notice that in my Plugin Manager configuration I had not a single plugin
   set to be auto activated on site creation. I just have a couple VISIBLE (set 
   as All Users) and others set as NONE.
 * Then, I decided to set ONE plugin to be autoactivated, JetPack, why not, it’s
   a handy plugin. Then I created one site, and the PHP errors have gone… **SO, 
   IT’S JUST A SMALL, TINY, UNDETECTED BUG, THAT COMES UP WHEN YOU DONT SET _AT 
   LEAST ONE PLUGIN TO BE AUTOACTIVATED_.**
    So, here you have the tips to fix it
   and my name to mention in the changelog 🙂
 * Cheers!
 *  [vickita](https://wordpress.org/support/users/vickita/)
 * (@vickita)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976967)
 * OMG, thank you.
 *  Thread Starter [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * (@kent-brockman)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976968)
 * Still unresolved. Waiting for the author answer 🙂
 *  [nit233](https://wordpress.org/support/users/nit233/)
 * (@nit233)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976974)
 * Still waiting 🙂
 *  Thread Starter [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * (@kent-brockman)
 * [11 years, 7 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976975)
 * No updates since April. Looks like this could’ve been abandoned… 🙁
 * Anyway, as I stated in the first post, the workaround is to set at least one 
   plugin to be autoactivated. Then you’ll be ok.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP errors when adding new sites’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/multisite-plugin-manager_131313.svg)
 * [Multisite Plugin Manager](https://wordpress.org/plugins/multisite-plugin-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/multisite-plugin-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/multisite-plugin-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/multisite-plugin-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multisite-plugin-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multisite-plugin-manager/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [Marcelo Pedra](https://wordpress.org/support/users/kent-brockman/)
 * Last activity: [11 years, 7 months ago](https://wordpress.org/support/topic/php-errors-when-adding-new-sites/#post-4976975)
 * Status: resolved