Title: Option saving error with windows while network activated
Last modified: August 24, 2016

---

# Option saving error with windows while network activated

 *  Resolved [Matt](https://wordpress.org/support/users/syntax53/)
 * (@syntax53)
 * [11 years ago](https://wordpress.org/support/topic/option-saving-error-with-windows-while-network-activated/)
 * When network activate on windows, when I try to save I get a file not found error
   because it tried to save to wp-admin/network/options.php.
 * in common.php–
 *     ```
       if (function_exists('is_plugin_active_for_network') && is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL)) {
       				$output[] = "<form method='post' action=''>\n";
       			} else {
       				$output[] = "<form method='post' action='options.php'>\n";
       			}
       ```
   
 * is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL) was returning
   false. Due to–
 *     ```
       if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' ) {
       	// this is the path of the plugin file relative to the plugins\ folder
       	define('EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL', 'ewww-image-optimizer\ewww-image-optimizer.php');
       	// the folder where we install optimization tools
       	define('EWWW_IMAGE_OPTIMIZER_TOOL_PATH', WP_CONTENT_DIR . '\ewww\\');
       } else {
       	// this is the path of the plugin file relative to the plugins/ folder
       	define('EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL', 'ewww-image-optimizer/ewww-image-optimizer.php');
       	// the folder where we install optimization tools
       	define('EWWW_IMAGE_OPTIMIZER_TOOL_PATH', WP_CONTENT_DIR . '/ewww/');
       }
       ```
   
 * in ewww-image-optimizer.php. Not sure if it’s because you aren’t escaping all
   the backslashes or what. I don’t think \e means anything, but regardless, PHP
   treats / and \ the same on windows so there is no need to differentiate. If I
   change the above code to:
 *     ```
       // this is the path of the plugin file relative to the plugins/ folder
       define('EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL', 'ewww-image-optimizer/ewww-image-optimizer.php');
       // the folder where we install optimization tools
       define('EWWW_IMAGE_OPTIMIZER_TOOL_PATH', WP_CONTENT_DIR . '/ewww/');
       ```
   
 * (removing the windows conditional) then the options saves correctly.
 * Reference: [http://php.net/manual/en/function.basename.php](http://php.net/manual/en/function.basename.php)
 * > On Windows, both slash (/) and backslash (\) are used as directory separator
   > character. In other environments, it is the forward slash (/).
 * [https://wordpress.org/plugins/ewww-image-optimizer/](https://wordpress.org/plugins/ewww-image-optimizer/)

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

 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [11 years ago](https://wordpress.org/support/topic/option-saving-error-with-windows-while-network-activated/#post-6035596)
 * Unfortunately, other problems arise when we use forward slashes on Windows, so
   I’ll have to come up with a better fix for those.
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [11 years ago](https://wordpress.org/support/topic/option-saving-error-with-windows-while-network-activated/#post-6035668)
 * Try this out: [https://downloads.wordpress.org/plugin/ewww-image-optimizer.zip](https://downloads.wordpress.org/plugin/ewww-image-optimizer.zip)
 * And if you have a non-production site you can test it on, would you mind installing
   Nextgen and activating it, just to make sure it doesn’t break something again?
   I don’t have a dev site on Windows readily accessible.
 *  Plugin Author [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * (@nosilver4u)
 * [11 years ago](https://wordpress.org/support/topic/option-saving-error-with-windows-while-network-activated/#post-6035805)
 * Nevermind, the nextgen stuff, I found I had done it better in another function,
   so I’ve reverted the EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL constant, and I’m using
   a built in WordPress constant for the plugins/ folder.

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

The topic ‘Option saving error with windows while network activated’ is closed to
new replies.

 * ![](https://ps.w.org/ewww-image-optimizer/assets/icon-256x256.png?rev=1582276)
 * [EWWW Image Optimizer](https://wordpress.org/plugins/ewww-image-optimizer/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ewww-image-optimizer/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ewww-image-optimizer/)
 * [Active Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ewww-image-optimizer/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ewww-image-optimizer/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [nosilver4u](https://wordpress.org/support/users/nosilver4u/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/option-saving-error-with-windows-while-network-activated/#post-6035805)
 * Status: resolved