Woocommerce Checkout Page Internal Server Error

Good Morning.

I’ve read through the related articles to the Internal Server Error I’m having with the Checkout Page in Woocommerce, but I’m not certain what is causing these issues. I’ve verified I’m using PHP 7.0.30 which is the latest our hosting company offers.

I’ve used Pro to edit all other Woocommerce pages with no issues at all, and had previously used it for the Checkout page as well. I’m not certain what is now causing this issue as the page worked perfectly fine a few weeks ago when I last tested the site. I’ve reached out to our hosting company about the error and they stated:

Thank you for writing in! It appears that this is due to a segfault being caused by looping files. The PHP files being called when proceeding with the checkout are looping back to each other over and over until the stack gets too large for the virtual memory segment and the kernel kills the process.

Any assistance would be greatly appreciated as this worked previously and I’d like to get it working again due to our pending site launch.

Hello @MPP_dshoales,

Thanks for asking. :slight_smile:

Please try out the solution mentioned in following thread and let us know the outcome:

Thanks.

I’ve added a secure note with the remaining information provided by our hosting company. Please let me know if there is additional information you need.

Additionally the PHP in our Admin panel states:
MySQL version: 5.6.38-83.0 with a green checkbox.

It also shows:
Cart: Page does not contain the shortcode.
Checkout: Page does not contain the shortcode.
My account: Page does not contain the shortcode.

However this have been saved in the Pro edited page and work for Cart and for My Account, but it does not work for Checkout now (but did work when I last checked several weeks ago.

Edit: I also forgot to mention that the shortcode works if I place it in a default page without an Pro editing done to it. The page breaks only when I’ve edited the page in Pro.

Hi There,

Please audit your page content for any broken HTML tag or script. Also, try adding your shortcode on a RAW Content element.

View your page in Skeleton mode to have an overview of the elements.

Do a testing for a plugin conflict. You can do this by deactivating all third party plugins, and seeing if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.

If nothing works, please provide us login credentials, in a secure note so we can take a closer look.

Thanks,

I attempted all of the recommended triage efforts again, including the ones specified above. I did have to recreate the page as once saved and I leave the Pro interface for the page, Pro is unable to display a preview anymore, meaning I cannot click and drag elements within the editor canvas. Unfortunately the page with the checkout shortcode is still generating an Internal Server Error once saved, while all other WooCommerce shortcodes display fine. I did notice however two odd behaviors:

  1. The page displays the content correctly, including a preview of the shortcode information, before and after saving while I am still in the layout view of the page. I can move, click on, and directly interact with elements in the layout window, however if I then open a different browser (while leaving the editor open with the page displayed correctly) and visit the same page in that other browser, I get the Internal Server Error.
    If I leave Pro’s layout view of the checkout page after saving, going back into the Pro editor for that checkout page results in correctly seeing the sections in the Pro sidebar, and I can click and edit the rows and sections without issue, but the layout view now shows an error: The preview was unresponsive after loading. This is most often related to a plugin conflict or aggressive page cacheing.

  2. Once I’d saved the Pro designed page with the shortcode added to the Classic Raw element, the sections were now displayed as Classic Sections instead of the newer versions. I noticed this when I deleted an existing section and readded it without renaming the section, and noticed that it now said “Classic Section 2”.

All of the above is with all plugins except for WooCommerce disabled. I am running with WooCommerce plugin 3.4.4 as I haven’t seen anything from Theme.co saying it was safe to upgrade to 3.4.5. For the purposes of this testing and your investigation I have left it at the 3.4.4 version.

Again, all shortcodes for WooCommerce are working as expected except for the [woocommerce_checkout] shortcode. I am using no Javascript or CSS to edit or affect this shortcode.

I have re-activated your account and have loaded the login credentials in the secure note as requested. Thank you for your assistance on this.

Hi There @MPP_dshoales

Did you change your site URL recently? From the errors provided by your host, it has SiteURL/HTML as the path and your current site is configured without HTML (see secure note).

If that is the case, you need to search the database for old site URL and replace with the new URL.

Thanks!

Thank you for the reply.

The only thing I changed recently was the URL on images from HTTP to HTTPS in the Media Library as we were getting issues with the SSL due to different URLs on images on the site.

I recently added a child theme, but beyond that I can’t think of any other changes I’d made that would have this impact.

How would I go about changing the URLs you’re indicating?

Hello There,

I have check everything and it seems okay. WooCommerce status ha s no problem also. You can check it in WooCommerce > Status.

Could you please enable the debug mode so that we can see what is the fatal error in your checkout page all about? You can do this by opening wp-config.php and adding

define('WP_DEBUG', true);

/* That's all, stop editing! Happy blogging. */

When you revisit the Check out page, you should have some error output describing the issue in more detail.

If possible, please provide us ftp so that we can investigate further as well.

Best Regards.

I’ve added the FTP account info above in the secure note. I may need to whitelist your IP though. I’ve also set WP_DEBUG and WP_DEBUG_LOG to true as well.

Thank you for your assistance. I hope we can figure out what went wrong soon as I need to get this working again for additional testing/training.

Hi,

I would like to check further but the ftp login provided is not working.

Do you mind deactivating ip restriction for a while so we can check.

Thanks

Good morning Paul. Unfortunately our hosting company doesn’t allow its users to disable the firewall, but I can whitelist you IP address. If you provide that I can whitelist it for today.

Hi @MPP_dshoales,

Unfortunately, we are from different places with varying IP addresses. We can give you our IPs but it will be different the next we check it. It will be a lot of back and forth and probably we’ll not able to check it at all.

Disabling it is more recommended.

Thanks!

We are on a shared hosting environment and the hosting company is unwilling to disable the FTP firewall as that would expose everyone in the environment beyond our site. Unfortunately providing a range of IP addresses this is the only solution they are able to accomodate.

Would uninstalling and reinstalling the Woocommerce plugin be a fix that would work for this? I’d love to isolate the exact cause of this issue incase it’s something that needs to be fixed in an update, but I don’t have the available time due to the site’s locked in launch date.

Edit: I’ll be monitoring for any response tonight. I will try to get any IP addresses Whitelisted as soon as possible after notification.

Hello There,

Since we do no have ftp access, could you please provide us the contents of your child theme’s functions.php file? We need to check it because according to the error, there is a fatal error originated from one of the functions added in the file.
Please post in your next reply the whole content code of the functions.php file.

Thank you in advance.

Here is the content of the Child themes functions.php:

<?php // ============================================================================= // FUNCTIONS.PHP // ----------------------------------------------------------------------------- // Overwrite or add your own custom functions to Pro in this file. // ============================================================================= // ============================================================================= // TABLE OF CONTENTS // ----------------------------------------------------------------------------- // 01. Enqueue Parent Stylesheet // 02. Additional Functions // ============================================================================= // Enqueue Parent Stylesheet // ============================================================================= add_filter( 'x_enqueue_parent_stylesheet', '__return_true' ); // Additional Functions // ============================================================================= function x_get_content_layout() { $content_layout = x_get_option( 'x_layout_content' ); if ( $content_layout != 'full-width' ) { if ( is_home() ) { $opt = x_get_option( 'x_blog_layout' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( is_singular( 'post' ) ) { $meta = get_post_meta( get_the_ID(), '_x_post_layout', true ); $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout; } elseif ( x_is_portfolio_item() ) { $layout = 'full-width'; } elseif ( x_is_portfolio() ) { $meta = get_post_meta( get_the_ID(), '_x_portfolio_layout', true ); $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta; } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) { $layout = 'content-sidebar'; } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) { $layout = 'sidebar-content'; } elseif ( is_page_template( 'template-layout-full-width.php' ) ) { $layout = 'full-width'; } elseif ( is_archive() ) { if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) { $opt = x_get_option( 'x_woocommerce_shop_layout_content' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } else { $opt = x_get_option( 'x_archive_layout' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } } elseif ( x_is_product() ) { $layout = 'sidebar-content'; } elseif ( x_is_bbpress() ) { $opt = x_get_option( 'x_bbpress_layout_content' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( x_is_buddypress() ) { $opt = x_get_option( 'x_buddypress_layout_content' ); $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt; } elseif ( is_404() ) { $layout = 'full-width'; } else { $layout = $content_layout; } } else { $layout = $content_layout; if ( x_is_product() ) { $layout = 'sidebar-content'; } } return $layout; } add_filter( 'ups_sidebar', 'x_woocommerce_sidebar' ); function x_woocommerce_sidebar($sidebar){ if( x_is_product_category() || x_is_product()){ return 'ups-sidebar-woocommerce_sidebar'; } return $sidebar; }

Hello There,

Please remove this first:

function x_get_content_layout() {

    $content_layout = x_get_option( 'x_layout_content' );

    if ( $content_layout != 'full-width' ) {
      if ( is_home() ) {
        $opt    = x_get_option( 'x_blog_layout' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_singular( 'post' ) ) {
        $meta   = get_post_meta( get_the_ID(), '_x_post_layout', true );
        $layout = ( $meta == 'on' ) ? 'full-width' : $content_layout;
      } elseif ( x_is_portfolio_item() ) {
        $layout = 'full-width';
      } elseif ( x_is_portfolio() ) {
        $meta   = get_post_meta( get_the_ID(), '_x_portfolio_layout', true );
        $layout = ( $meta == 'sidebar' ) ? $content_layout : $meta;
      } elseif ( is_page_template( 'template-layout-content-sidebar.php' ) ) {
        $layout = 'content-sidebar';
      } elseif ( is_page_template( 'template-layout-sidebar-content.php' ) ) {
        $layout = 'sidebar-content';
      } elseif ( is_page_template( 'template-layout-full-width.php' ) ) {
        $layout = 'full-width';
      } elseif ( is_archive() ) {
        if ( x_is_shop() || x_is_product_category() || x_is_product_tag() ) {
          $opt    = x_get_option( 'x_woocommerce_shop_layout_content' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        } else {
          $opt    = x_get_option( 'x_archive_layout' );
          $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
        }
      } elseif ( x_is_product() ) {
        $layout = 'sidebar-content';
      } elseif ( x_is_bbpress() ) {
        $opt    = x_get_option( 'x_bbpress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( x_is_buddypress() ) {
        $opt    = x_get_option( 'x_buddypress_layout_content' );
        $layout = ( $opt == 'sidebar' ) ? $content_layout : $opt;
      } elseif ( is_404() ) {
        $layout = 'full-width';
      } else {
        $layout = $content_layout;
      }
    } else {
      $layout = $content_layout;
      if ( x_is_product() ) {
        $layout = 'sidebar-content';
      } 
    }

    return $layout;

}

//add_filter( 'ups_sidebar', 'x_woocommerce_sidebar' );
function x_woocommerce_sidebar($sidebar){
if( x_is_product_category() || x_is_product()){
return 'ups-sidebar-woocommerce_sidebar';
}
return $sidebar;
}

We need to test whether one of this lines is causing the issue or not. We will know that it has some errors in it when the check out page will display without the error 500.

Please let us know how it goes.

I removed the lines as requested from the child-themes functions.php file, and unfortunately I’m still getting the 500 Internal Server error.

Hey There,

Since you removed the code, what is the error message displayed in the error log now?
Could you please share it?

Thanks.

This is the error.log from 09/28.

[28-Sep-2018 03:38:44 UTC] PHP Notice: id was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(’/themes/pro/woocommerce.php’), x_get_view, X_View_Router::render, include(’/themes/pro/framework/views/icon/woocommerce.php’), woocommerce_content, wc_get_template_part, load_template, require(’/plugins/woocommerce/templates/content-single-product.php’), do_action(‘woocommerce_after_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_output_product_data_tabs, wc_get_template, include(’/themes/pro/woocommerce/single-product/tabs/tabs.php’), comments_template, require(’/themes/pro/woocommerce/single-product-reviews.php’), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /chroot/home/itsacrui/dev.itsacruisego.com/html/wp-includes/functions.php on line 4161
[28-Sep-2018 03:38:46 UTC] PHP Notice: id was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(’/themes/pro/woocommerce.php’), x_get_view, X_View_Router::render, include(’/themes/pro/framework/views/icon/woocommerce.php’), woocommerce_content, wc_get_template_part, load_template, require(’/plugins/woocommerce/templates/content-single-product.php’), do_action(‘woocommerce_after_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_output_product_data_tabs, wc_get_template, include(’/themes/pro/woocommerce/single-product/tabs/tabs.php’), comments_template, require(’/themes/pro/woocommerce/single-product-reviews.php’), WC_Abstract_Legacy_Product->__get, wc_doing_it_wrong Please see Debugging in WordPress for more information. (This message was added in version 3.0.) in /chroot/home/itsacrui/dev.itsacruisego.com/html/wp-includes/functions.php on line 4161
[28-Sep-2018 04:17:49 UTC] PHP Notice: MemcachePool::getstats(): Server localhost (tcp 11211, udp 0) failed with: Connection refused (111) in /chroot/home/itsacrui/dev.itsacruisego.com/html/wp-content/plugins/wp-serverinfo/wp-serverinfo.php on line 252
[28-Sep-2018 04:18:29 UTC] PHP Notice: MemcachePool::getstats(): Server localhost (tcp 11211, udp 0) failed with: Connection refused (111) in /chroot/home/itsacrui/dev.itsacruisego.com/html/wp-content/plugins/wp-serverinfo/wp-serverinfo.php on line 252

Hi,

I tried creating a new checkout page and assigned it in woocommerce.

It seems to work without any issues.

https://dev.itsacruisego.com/checkout1/

Kindly check in your end.

Thanks