Error Log File Is Increasing Rapidly

Hi my error log file is getting filled with the below line. can you please advice needs to be fixed?

PHP Notice: Use of undefined constant DESCR_SL - assumed 'DESCR_SL' in /home/xxxx/public_html/app/functions/fn.companies.php on line 390

Thanks in advance

You have something seriously wrong since DESCR_SL is defined in the init process. Would require investigation on your server.

Are there other errors that might point more to the source? I.e. "Notice undefined index XYZ...." or similar.

I suggest you to disable 3rd party modules and check. If the issue still exists, please contact CS-Cart support team

You have something seriously wrong since DESCR_SL is defined in the init process. Would require investigation on your server.

Are there other errors that might point more to the source? I.e. "Notice undefined index XYZ...." or similar.

Actually besides this warning there is no other error in the log file. The entire log file is just this one PHP notice

Then you must have something in an addon that is running in the "config" portion of the page-load which should be being run AFTER the "init". Coomon mistake by some addon developers is to try to reference languages or currency in the config portion.

Then you must have something in an addon that is running in the "config" portion of the page-load which should be being run AFTER the "init". Coomon mistake by some addon developers is to try to reference languages or currency in the config portion.

You may be bang on. I do notice the following line in the log once in a while

Use of undefined constant CART_SECONDARY_CURRENCY - assumed 'CART_SECONDARY_CURRENCY' in /home/xxxx/public_html/app/addons/full_page_cache/func.php on line 198
Any advice how to fix it?

Yes, that is one of the symptoms of using constants before they are initialized properly.

You can add the following code before mentioned line

if (!defined('CART_SECONDARY_CURRENCY')) {
    fn_init_currency(array());
}

it should remove error

You can add the following code before mentioned line

if (!defined('CART_SECONDARY_CURRENCY')) {
    fn_init_currency(array());
}

it should remove error

Thanks I will certainly try this

Which error will it remove:

Use of undefined constant CART_SECONDARY_CURRENCY - assumed 'CART_SECONDARY_CURRENCY' in /home/xxxx/public_html/app/addons/full_page_cache/func.php on line 198

OR

PHP Notice: Use of undefined constant DESCR_SL - assumed 'DESCR_SL' in /home/xxxx/public_html/app/functions/fn.companies.php on line 390

You can add the following code before mentioned line

if (!defined('CART_SECONDARY_CURRENCY')) {
    fn_init_currency(array());
}

it should remove error

And it will break the proper flow of the cart initialization... if CART_SECONDARY_CURRENCY is not defined, then there is a more fundamental problem and it should not be covered up.

And it will break the proper flow of the cart initialization... if CART_SECONDARY_CURRENCY is not defined, then there is a more fundamental problem and it should not be covered up.

No, it will not break anything. This code is used in several core files

Thanks I will certainly try this

Which error will it remove:

Use of undefined constant CART_SECONDARY_CURRENCY - assumed 'CART_SECONDARY_CURRENCY' in /home/xxxx/public_html/app/addons/full_page_cache/func.php on line 198

OR

PHP Notice: Use of undefined constant DESCR_SL - assumed 'DESCR_SL' in /home/xxxx/public_html/app/functions/fn.companies.php on line 390

First one

, just make a search over the code

No, it will not break anything. This code is used in several core files

On this, we disagree. What code outside the core would be executing before the currencies are initialized? My point is that the code is constructed incorrectly and is most likely doing something in the config process that should be deferred to a later point.

Just ignore the error if you're going to cover it up. The easiest way to discover is to generate a stack trace

If I go into the app directory on the current V4/MVE instance, and do a

find . -type f -name '*.php' -print0 | xargs -0 grep 'defined.*SECOND'

it comes up with no results. Hence I don't believe that the code is "used in several core files". Please advise.

For example, check the fn_init_company_id_redirect function

http://prntscr.com/irw8xv

Such code can be used is cron tasks, api requests, etc where some functions are called before main initialzation

That's a little bit of a different case since it's trying to redirect BEFORE the system has initialized and is trying to get the proper parameters to set for the redirection.

In any event, if he's encountering this issue then there is something wrong somewhere since it certainly doesn't behave that way out of the box. As you stated above, the best check is to disable 3rd party addons and then re-enable one by one till the source is identified. Tedious but without inserting a bactrace, only way to see what's causing his issue.

Right, examination is required in any way.

Our error log file appears to show similar issues

25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::query(): Couldn't fetch mysqli in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 79
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  Tygh\Backend\Database\Mysqli::errorCode(): Couldn't fetch mysqli in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 131
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  Error while sending QUERY packet. PID=6091 in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 79
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  Error while sending QUERY packet. PID=6083 in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 79
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  Error while sending QUERY packet. PID=6161 in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 79
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:37:47 Europe/Berlin] PHP Warning:  mysqli::__construct(): (HY000/2002): No such file or directory in /home/pasioonline/public_html/app/Tygh/Backend/Database/Mysqli.php on line 40
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product_code in /home/pasioonline/public_html/app/addons/seo/func.php on line 1822
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product in /home/pasioonline/public_html/app/addons/seo/func.php on line 1823
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product_code in /home/pasioonline/public_html/app/addons/seo/func.php on line 1822
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product in /home/pasioonline/public_html/app/addons/seo/func.php on line 1823
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product_code in /home/pasioonline/public_html/app/addons/seo/func.php on line 1822
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product in /home/pasioonline/public_html/app/addons/seo/func.php on line 1823
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product_code in /home/pasioonline/public_html/app/addons/seo/func.php on line 1822
[25-Mar-2018 13:41:20 Europe/Berlin] PHP Notice:  Undefined index: product in /home/pasioonline/public_html/app/addons/seo/func.php on line 1823

Do a "repair" on your database. It is most likely trying to reference an index that doens't exist.

Do a "repair" on your database. It is most likely trying to reference an index that doens't exist.

Via Cpanel you mean Tony?

Yes, or phpMyAdmin

Yes, or phpMyAdmin

Well thanks for the suggestion but it failed.

pasioonline_mariadb.phinxlog1514373370
note     : The storage engine for the table doesn't support repair
pasioonline_mariadb.phinxlog1521324432
note     : The storage engine for the table doesn't support repair