Error 500 when using search widget
-
Hello!
I’m getting error 500 when using page internal search. I can search 1 keyword and then i’m getting error 500. If I clear cache then I can search 1 keyword again. When I deactivate WP Super Cache, then internal search works. What could be the problem? I have latest WP Super Cache version.
The page I need help with: [log in to see the link]
-
Hi @0utf1t,
You should check PHP error log. Also, it’s helpful to enable debugging into WP (Enabling the WP_DEBUG_LOG constant improves your debugging experience by sending notices and messages to wp-content/debug.log). Please send details from this log.
Do you see difference is you exclude is_search from caching on WPSC dashboard? ( Settings -> WP Super Cache -> Advanced -> Accepted Filenames & Rejected URIs )
Debug from WPSC
<?php if ( !isset( $_SERVER[ "PHP_AUTH_USER" ] ) || ( $_SERVER[ "PHP_AUTH_USER" ] != "4e261f2aa5f96f1437fe3a66ab200af5" && $_SERVER[ "PHP_AUTH_PW" ] != "4e261f2aa5f96f1437fe3a66ab200af5" ) ) { header( "WWW-Authenticate: Basic realm=\"WP-Super-Cache Debug Log\"" ); header("HTTP/1.0 401 Unauthorized"); echo "You must login to view the debug log"; exit; } $debug_log = file( "./7f7d4ab25b0c9c6e6cd041a91be031ba.txt" ); $start_log = 1 + array_search( "<" . "?php // END HEADER ?" . ">" . PHP_EOL, $debug_log ); if ( $start_log > 1 ) { $debug_log = array_slice( $debug_log, $start_log ); } ?><form action="" method="GET"><?php $checks = array( "wp-admin", "exclude_filter", "wp-content", "wp-json" ); foreach( $checks as $check ) { if ( isset( $_GET[ $check ] ) ) { $$check = 1; } else { $$check = 0; } } if ( isset( $_GET[ "filter" ] ) ) { $filter = htmlspecialchars( $_GET[ "filter" ] ); } else { $filter = ""; } unset( $checks[1] ); // exclude_filter ?> Exclude requests: <br /> <?php foreach ( $checks as $check ) { ?> <label><input type="checkbox" name="<?php echo $check; ?>" value="1" <?php if ( $$check ) { echo "checked"; } ?> /> <?php echo $check; ?></label><br /> <?php } ?> <br /> Text to filter by: <input type="text" name="filter" value="<?php echo $filter; ?>" /><br /> <input type="checkbox" name="exclude_filter" value="1" <?php if ( $exclude_filter ) { echo "checked"; } ?> /> Exclude by filter instead of include.<br /> <input type="submit" value="Submit" /> </form> <?php foreach ( $debug_log as $t => $line ) { foreach( $checks as $check ) { if ( $$check && false !== strpos( $line, " /$check/" ) ) { unset( $debug_log[ $t ] ); } } if ( $filter ) { if ( false !== strpos( $line, $filter ) && $exclude_filter ) { unset( $debug_log[ $t ] ); } elseif ( false === strpos( $line, $filter ) && ! $exclude_filter ) { unset( $debug_log[ $t ] ); } } } foreach( $debug_log as $line ) { echo $line . "<br />"; } Debug from WordPress Notice: Funkcija add_custom_background is deprecated since version 4.3.0! Use add_theme_support( 'custom-background', $args ). in /var/www/html/wp-includes/functions.php on line 3618 Notice: Funkcija add_custom_image_header is deprecated since version 4.3.0! Use add_theme_support( 'custom-header', $args ). in /var/www/html/wp-includes/functions.php on line 3618 Notice: The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct() instead. in /var/www/html/wp-includes/functions.php on line 3669-
This reply was modified 8 years, 6 months ago by
0utf1t.
-
This reply was modified 8 years, 6 months ago by
Jan Dembowski.
This was in debug file. Do you see anything there?
I excluded is_search but still the same.
I think this started to happen after WPSC update which I did recently. Before search worked( although I hadn’t checked it very often)
It’s PHP code for viewing WPSC debug log and it doesn’t contains PHP errors.
You should edit wp-config.php to enable WP debug mode – NOT WPSC debug mode. Info: https://codex.ww.wp.xz.cn/Debugging_in_WordPress If it isn’t too easy for you, then you should find PHP error log on CPanel (or ask hosting where you can find this log).
If you can access via FTP, then you can try to temporary install simple plugin which will help us to find more details:
https://github.com/stracker-phil/wp-no-white-screenAnyway, I just got error when I tried to access to your website:
Fatal error: Call to undefined function json_encode() in /wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 206It’s pretty strange because it’s standard PHP function:
http://php.net/manual/en/function.json-encode.phpThere are PR which will fix this error – https://github.com/Automattic/wp-super-cache/pull/384 As quick workaround you can replace json_encode with wp_json_encode because you have installed WP version >= 4.1
I quickly wrote this, I’ll check tomorrow more details. Please send your feedback in meantime.
PS. You can remove “debugging” now because it breaks HTML code or add
define( 'WP_DEBUG_DISPLAY', false );to prevent output into browser.-
This reply was modified 8 years, 6 months ago by
Saša.
I replaced json_encode with wp_json_encode still the error > Fatal error: Call to undefined function wp_json_encode() in /var/www/html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php on line 206
Ok I installed your plugin, this is what was shown:
Redefining already defined constructor for class WP_Table_Reloaded_Controller_Frontend Backtrace from notice In /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php [line 60]: 1. /var/www/html/wp-content/plugins/wp-table-reloaded/wp-table-reloaded.php [line 59] calling process_error() 2. /var/www/html/wp-content/plugins/wp-table-reloaded/wp-table-reloaded.php [line 59] calling include_once() 3. /var/www/html/wp-settings.php [line 254] calling include_once() 4. /var/www/html/wp-config.php [line 108] calling require_once() 5. /var/www/html/wp-load.php [line 37] calling require_once() 6. /var/www/html/wp-blog-header.php [line 12] calling require_once() 7. /var/www/html/index.php [line 17] calling require() Redefining already defined constructor for class WP_Table_Reloaded_Controller_Base Backtrace from notice In /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-base.php [line 98]: 1. /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php [line 14] calling process_error() 2. /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php [line 14] calling require_once() 3. /var/www/html/wp-content/plugins/wp-table-reloaded/wp-table-reloaded.php [line 59] calling include_once() 4. /var/www/html/wp-settings.php [line 254] calling include_once() 5. /var/www/html/wp-config.php [line 108] calling require_once() 6. /var/www/html/wp-load.php [line 37] calling require_once() 7. /var/www/html/wp-blog-header.php [line 12] calling require_once() 8. /var/www/html/index.php [line 17] calling require() Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php:60) Backtrace from warning In /var/www/html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php [line 60]: 1. [line ?] calling process_error() 2. /var/www/html/wp-content/plugins/wp-super-cache/wp-cache-phase2.php [line 60] calling header() 3. /var/www/html/wp-content/plugins/wp-super-cache/wp-cache-phase1.php [line 397] calling wp_cache_phase2() 4. /var/www/html/wp-settings.php [line 267] calling wp_cache_postload() 5. /var/www/html/wp-config.php [line 108] calling require_once() 6. /var/www/html/wp-load.php [line 37] calling require_once() 7. /var/www/html/wp-blog-header.php [line 12] calling require_once() 8. /var/www/html/index.php [line 17] calling require() Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php:60) Backtrace from warning In /var/www/html/wp-content/plugins/qtranslate-x/qtranslate_core.php [line 388]: 1. [line ?] calling process_error() 2. /var/www/html/wp-content/plugins/qtranslate-x/qtranslate_core.php [line 388] calling setcookie() 3. /var/www/html/wp-content/plugins/qtranslate-x/qtranslate_core.php [line 398] calling qtranxf_setcookie_language() 4. /var/www/html/wp-content/plugins/qtranslate-x/qtranslate_core.php [line 213] calling qtranxf_set_language_cookie() 5. /var/www/html/wp-content/plugins/qtranslate-x/qtranslate_core.php [line 69] calling qtranxf_detect_language() 6. [line ?] calling qtranxf_init_language() 7. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 8. /var/www/html/wp-settings.php [line 276] calling do_action() 9. /var/www/html/wp-config.php [line 108] calling require_once() 10. /var/www/html/wp-load.php [line 37] calling require_once() 11. /var/www/html/wp-blog-header.php [line 12] calling require_once() 12. /var/www/html/index.php [line 17] calling require() Funkcija add_custom_background kopÅ¡ versijas 3.4 skaitÄs novecojusi! Lietojiet Å¡o add_theme_support( 'custom-background', $args ). Backtrace from notice In /var/www/html/wp-includes/functions.php [line 3618]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/functions.php [line 3618] calling trigger_error() 3. /var/www/html/wp-includes/deprecated.php [line 2972] calling _deprecated_function() 4. /var/www/html/wp-content/themes/twentyelevenchild2/functions.php [line 109] calling add_custom_background() 5. [line ?] calling twentyeleven_setup() 6. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 7. /var/www/html/wp-settings.php [line 376] calling do_action() 8. /var/www/html/wp-config.php [line 108] calling require_once() 9. /var/www/html/wp-load.php [line 37] calling require_once() 10. /var/www/html/wp-blog-header.php [line 12] calling require_once() 11. /var/www/html/index.php [line 17] calling require() Funkcija add_custom_image_header kopÅ¡ versijas 3.4 skaitÄs novecojusi! Lietojiet Å¡o add_theme_support( 'custom-header', $args ). Backtrace from notice In /var/www/html/wp-includes/functions.php [line 3618]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/functions.php [line 3618] calling trigger_error() 3. /var/www/html/wp-includes/deprecated.php [line 2936] calling _deprecated_function() 4. /var/www/html/wp-content/themes/twentyelevenchild2/functions.php [line 141] calling add_custom_image_header() 5. [line ?] calling twentyeleven_setup() 6. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 7. /var/www/html/wp-settings.php [line 376] calling do_action() 8. /var/www/html/wp-config.php [line 108] calling require_once() 9. /var/www/html/wp-load.php [line 37] calling require_once() 10. /var/www/html/wp-blog-header.php [line 12] calling require_once() 11. /var/www/html/index.php [line 17] calling require() The called constructor method for WP_Widget is deprecated since version 4.3.0! Use __construct() instead. Backtrace from notice In /var/www/html/wp-includes/functions.php [line 3669]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/functions.php [line 3669] calling trigger_error() 3. /var/www/html/wp-includes/class-wp-widget.php [line 171] calling _deprecated_constructor() 4. /var/www/html/wp-content/themes/twentyelevenchild2/inc/widgets.php [line 20] calling WP_Widget() 5. /var/www/html/wp-includes/class-wp-widget-factory.php [line 43] calling Twenty_Eleven_Ephemera_Widget() 6. /var/www/html/wp-includes/widgets.php [line 113] calling register() 7. /var/www/html/wp-content/themes/twentyelevenchild2/functions.php [line 373] calling register_widget() 8. [line ?] calling twentyeleven_widgets_init() 9. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 10. /var/www/html/wp-includes/widgets.php [line 1463] calling do_action() 11. [line ?] calling wp_widgets_init() 12. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 13. /var/www/html/wp-settings.php [line 392] calling do_action() 14. /var/www/html/wp-config.php [line 108] calling require_once() 15. /var/www/html/wp-load.php [line 37] calling require_once() 16. /var/www/html/wp-blog-header.php [line 12] calling require_once() 17. /var/www/html/index.php [line 17] calling require() Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php:60) Backtrace from warning In /var/www/html/wp-includes/class-wp.php [line 473]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/class-wp.php [line 473] calling header() 3. /var/www/html/wp-includes/class-wp.php [line 680] calling send_headers() 4. /var/www/html/wp-includes/functions.php [line 952] calling main() 5. /var/www/html/wp-blog-header.php [line 14] calling wp() 6. /var/www/html/index.php [line 17] calling require() Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php:60) Backtrace from warning In /var/www/html/wp-includes/functions.php [line 1080]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/functions.php [line 1080] calling header() 3. /var/www/html/wp-includes/class-wp.php [line 632] calling status_header() 4. /var/www/html/wp-includes/class-wp.php [line 682] calling handle_404() 5. /var/www/html/wp-includes/functions.php [line 952] calling main() 6. /var/www/html/wp-blog-header.php [line 14] calling wp() 7. /var/www/html/index.php [line 17] calling require() Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/plugins/wp-table-reloaded/controllers/controller-frontend.php:60) Backtrace from warning In /var/www/html/wp-includes/pluggable.php [line 1224]: 1. [line ?] calling process_error() 2. /var/www/html/wp-includes/pluggable.php [line 1224] calling header() 3. /var/www/html/wp-includes/canonical.php [line 499] calling wp_redirect() 4. [line ?] calling redirect_canonical() 5. /var/www/html/wp-includes/plugin.php [line 525] calling call_user_func_array() 6. /var/www/html/wp-includes/template-loader.php [line 12] calling do_action() 7. /var/www/html/wp-blog-header.php [line 16] calling require_once() 8. /var/www/html/index.php [line 17] calling require()Ok right now I disabeled debugging in wp-config.php
Should I maybe update to lastest wordpress version? I’m reluctant to do that right now because then I will have to migrate from qtranslatex plugin to something else and I read that it can be complicated.
Thanks for your help.
-
This reply was modified 8 years, 6 months ago by
Jan Dembowski.
I’ve analyzed everything and I see following problems:
- Your server has installed deprecated PHP version (PHP 5.3.x). Also, it seems that JSON extesion (which is bundled by default) is removed from PHP. It’s recommended update to PHP 7.0 (or at least to 5.6 as intermediate version), but you should update all plugins before. You can try plugin PHP Compatibility Checker to find possible issues before this update. You can see WP recommendation on https://ww.wp.xz.cn/about/requirements/.
- Qtranslate-X is tricky for update and it isn’t fully tested on newer WP version. You should try to duplicate your website to test server and try it first on test server.
- Direct update from WP 4.5 to 4.9 isn’t recommended. You can see https://codex.ww.wp.xz.cn/Upgrading_WordPress_Extended (for ex. update first to 4.7 then to 4.9). Also, you need to test everything on test server before live update.
- Your theme is outdated. I think that many warnings are coming from the theme. You should update theme and code into child theme. It also could be tricky.
As quick workaround because you don’t use debug mode in WPSC, you can replace all occurrences of json_encode to wp_json_encode – following lines:
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase1.php#L153
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase1.php#L161
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase1.php#L206
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase2.php#L55
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase2.php#L464
https://github.com/Automattic/wp-super-cache/blob/1.5.8/wp-cache-phase2.php#L1264Or you can try to download files
wp-cache-phase1.phpandwp-cache-phase2.phpfrom PR 384.I hope that helps. Anyway it’s pretty complex issue and not only related to WPSC.
Regards,
SasaOk I update to wordpress 4.7 and asked my host to updated php to 7.0, they will do it tonight.
About theme. Right now I have Twenty Eleven customised into child theme. How can I update it? I updated original Twenty Eleven, should I copy some files into child theme so I don’t lose customisation?
I see that you fixed issue related to WPSC and updated PHP version.
Other questions isn’t directly related to WPSC. I tried to answer somehow on them. Anyway you should monitor PHP notices/errors and try to fix them because it’s possible that some older code isn’t fully compatible with PHP 7.0.
Regarding to child theme, you should review changes in each specific file, then you can try to re-apply them on original files from the latest theme (which could be very tricky). Maybe you don’t need to do it if everything works as should. Anyway please try to ask it on other forum because it’s out of this topic.
Regards,
SasaYes, now it works. Thanks again for your help.
As you child theme I updated theme and the copied modified css and php into new files
-
This reply was modified 8 years, 6 months ago by
The topic ‘Error 500 when using search widget’ is closed to new replies.