Page 1 of 1

internal server error 500 after click confirm button on checkout page

Posted: Wed Jun 12, 2024 5:53 pm
by samkung
HI all,
after i installed an extension. i have a problem that i click confirm button on checkout page will get internal server error 500
https:/domain.com/index.php?route=checkout/success
CMS still get the order invoice, only front end server 500.

I tried to debug: (chat gdp help)
i created a xml named "debug_checkout.xml" on vqmod/xml/ debug_checkout.xml, try to print error log on each part, here is the code:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
    <id>debug_checkout</id>
    <version>1.0</version>
    <vqmver>2.6.1</vqmver>
    <author>Your Name</author>
    
    
    <!-- Adding debug logs in confirm.php -->
    <file name="catalog/controller/checkout/confirm.php">
        <operation>
            <search><![CDATA[<?php]]></search>
            <add position="after"><![CDATA[
error_log('Reached confirm.php');
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$this->model_checkout_order->addOrder($order_data);]]></search>
            <add position="after"><![CDATA[
error_log('Order data: ' . print_r($order_data, true));
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$this->response->redirect($this->url->link('checkout/success'));]]></search>
            <add position="before"><![CDATA[
error_log('Order ID: ' . $order_id);
            ]]></add>
        </operation>
    </file>
    
    <!-- Adding debug logs in order.php -->
    <file name="catalog/model/checkout/order.php">
        <operation>
            <search><![CDATA[public function addOrder($data) {]]></search>
            <add position="after"><![CDATA[
error_log('Entered addOrder method');
        ]]></add>
        </operation>
        <operation>
            <search><![CDATA[return $order_id;]]></search>
            <add position="before"><![CDATA[
error_log('Order ID to be returned: ' . $order_id);
        ]]></add>
        </operation>
    </file>
    
    <!-- Adding debug logs in success.php -->
    <file name="catalog/controller/checkout/success.php">
        <operation>
            <search><![CDATA[<?php]]></search>
            <add position="after"><![CDATA[
error_log('Reached success.php');
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$this->document->setTitle($this->language->get('heading_title'));]]></search>
            <add position="before"><![CDATA[
error_log('Setting document title');
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$data['breadcrumbs'] = array();]]></search>
            <add position="after"><![CDATA[
error_log('Initializing breadcrumbs');
            ]]></add>
        </operation>
        <operation>
            <search><![CDATA[$data['continue'] = $this->url->link('common/home');]]></search>
            <add position="before"><![CDATA[
error_log('Setting continue link');
            ]]></add>
        </operation>
    </file>
</modification>
then check Cpanel websever error log:
AH01797: client denied by server configuration: /home/domain/public_html/index.php

index.php

Code: Select all

<?php

// Version
define('VERSION', '2.3.0.2');

// Configuration
if (is_file('config.php')) {
	require_once('config.php');
}

// Install
if (!defined('DIR_APPLICATION')) {
	header('Location: install/index.php');
	exit;
}

// VirtualQMOD
require_once('./vqmod/vqmod.php');
VQMod::bootup();

// VQMODDED Startup
require_once(VQMod::modCheck(DIR_SYSTEM . 'startup.php'));

start('catalog');
config.php

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://domain.com/');

// HTTPS
define('HTTPS_SERVER', 'https://domain.com/');

// DIR
define('DIR_APPLICATION', '/home/demo/public_html/catalog/');
define('DIR_SYSTEM', '/home/demo/public_html/system/');
define('DIR_LANGUAGE', '/home/demo/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/demo/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/demo/public_html/system/config/');
define('DIR_IMAGE', '/home/demo/public_html/image/');
define('DIR_CACHE', '/home/demo/public_html/system/storage/cache/');
define('DIR_DOWNLOAD', '/home/demo/public_html/system/storage/download/');
define('DIR_LOGS', '/home/demo/public_html/system/storage/logs/');
define('DIR_MODIFICATION', '/home/demo/public_html/system/storage/modification/');
define('DIR_UPLOAD', '/home/demo/public_html/system/storage/upload/');

//Sam
define('ERROR_DISPLAY', true);
define('ERROR_LOG', true);
define('ERROR_FILENAME', 'error.log');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'xxxxx');
define('DB_PASSWORD', '^xxxxx');
define('DB_DATABASE', 'xxxxx');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');
System/storage/logs/error.log:
nothing show

Did someone can give me direction for debug?
it is hard to understand opencart process, is confirm.php > order.php > success.php?
still not found the bug, feel some lost.

Re: internal server error 500 after click confirm button on checkout page

Posted: Wed Jun 12, 2024 8:28 pm
by JNeuhoff
You need to ask your webhost for the server's error log, it's not the same as the OpenCart error.log.

Re: internal server error 500 after click confirm button on checkout page

Posted: Wed Jun 12, 2024 11:17 pm
by paulfeakins
JNeuhoff wrote:
Wed Jun 12, 2024 8:28 pm
You need to ask your webhost for the server's error log, it's not the same as the OpenCart error.log.
This might help: https://www.antropy.co.uk/blog/error-me ... howing-up/

Re: internal server error 500 after click confirm button on checkout page

Posted: Thu Jun 13, 2024 6:35 am
by Elevate
In your public_html directory there is likely a file called error_log that the server generated. It will contain the error message(s)