Product Options PHP error
-
Everytime I add a product option and click update I get an error saying:
Warning: Cannot modify header information – headers already sent by (output started at domain.com/wp-content/plugins/sunshine-photo-cart/sunshine-functions.php:31) in domain.com/wp-includes/pluggable.php on line 1171
Why is this happening?
Agon
-
There may be a conflict with either a plugin or your theme. Please disable all non-Sunshine plugins and use a default WordPress theme (like Twenty Sixteen) and check again. If the issue goes away, enable your theme and try again. If still not present, enable plugins one-by-one and test after each until you find the one that causes the conflict and we can go from there.
I’ve already done that. I changed my theme to twentyfifteen and disabled all the plugins except “Sunshine Photo Cart” and “Sunshine Photo Cart – Product Options / Variations” and I still get the same error.
You would need to enabled debugging and check your error logs: https://codex.www.ads-software.com/WP_DEBUG
Basically add the following to your wp-config.php
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_LOG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );Try to add a product option. Then look in wp-content/debug.log and see what the errors are.
here’s the log:
[12-Jun-2016 18:13:23 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:23 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:24 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:24 UTC] PHP Notice: Undefined variable: product_options in /home/heaven/public_html/wp-content/plugins/sunshine-product-options/product-options.php on line 110
[12-Jun-2016 18:13:24 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:24 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:25 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:28 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:28 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:29 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:29 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/heaven/public_html/wp-content/plugins/sunshine-product-options/product-options.php:321) in /home/heaven/public_html/wp-includes/pluggable.php on line 1171
[12-Jun-2016 18:13:34 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:34 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:34 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:34 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:34 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:35 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:35 UTC] PHP Notice: Undefined variable: product_options in /home/heaven/public_html/wp-content/plugins/sunshine-product-options/product-options.php on line 110
[12-Jun-2016 18:13:35 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:35 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:35 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:47 UTC] PHP Warning: include(/home/heaven/public_html/wp-content/advanced-cache.php): failed to open stream: No such file or directory in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:47 UTC] PHP Warning: include(): Failed opening ‘/home/heaven/public_html/wp-content/advanced-cache.php’ for inclusion (include_path=’.:/opt/php54/lib/php’) in /home/heaven/public_html/wp-settings.php on line 74
[12-Jun-2016 18:13:47 UTC] PHP Notice: Undefined index: tax_location in /home/heaven/public_html/wp-content/plugins/sunshine-photo-cart/classes/cart.class.php on line 294
[12-Jun-2016 18:13:47 UTC] PHP Warning: Cannot modify header information – headers already sent by (output started at /home/heaven/public_html/wp-content/plugins/sunshine-product-options/product-options.php:321) in /home/heaven/public_html/wp-includes/pluggable.php on line 1171It sounds like your server is set to display every single small PHP notice, which in a production server that absolutely should not be happening.
Please see this article on how to disable those notices from being displayed: https://aristath.github.io/blog/wp-hide-php-errors
When I follow the instructions on that site it does not even create a log file.
If you use the following:
ini_set(‘log_errors’,’On’);
ini_set(‘display_errors’,’Off’);
ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, false);
define(‘WP_DEBUG_LOG’, true);
define(‘WP_DEBUG_DISPLAY’, false);That would create an error log in a spot on your server defined in your server settings, not in the wp-content folder. What the above code does is enable error logging at the server level, disables all notices at the server level and disables all error logging for WordPress.
well then since I have cpanel on my server it would be in the error_log section of cpanel and that too is empty.
But now after I add a new option it just goes to basically a blank page at “wp-admin/post.php” that says:
New Option Name: “my option name”
And that’s it.
It does save the new product option however.
Why is this marked as resolved? This is not resolved.
Like I said above after I add a new option it just goes to a blank page at “wp-admin/post.php” that says:
New Option Name: “my option name”
And that’s it.
I did not mark it as resolved, I am still looking into this
Kewl. Thank you! ??
So your server should not be displaying any PHP warnings. When the warnings are displayed, PHP cannot do any redirects which is necessary after the Product Option is saved (as with any Post or Page within WordPress). Typically the code I provided earlier would stop those warnings from displaying and put them into an error log instead. You may need to contact your host as they may have different ways of disabling those PHP warnings.
I don’t get any PHP warnings now. That code took care of it. I don’t get any warnings in any of my log files now.
What I get after saving a product option is, like I said, a white page that says:
New Option Name: “my option name”
“my option name” being whatever name I gave it.
And I have to hit back the back button to get back to the product options page.
So the warnings are gone and its still messed up.
Definitely strange, I can’t reproduce that anywhere myself. Can you try disabling all other plugins and use a default them (Twenty Sixteen) and try again?
That didn’t work.
- The topic ‘Product Options PHP error’ is closed to new replies.