This topic contains a post which is marked as Best Answer. Press here if you would like to see it.
*

karotu

  • **
  • 5 posts
ABS_PATH is not loaded
« on: December 29, 2021, 04:21:51 AM »
Hi,

I have setup cron as follows on my hosting to run hourly..
/usr/local/bin/php /home/antXXXX/public_html/oc-includes/osclass/cron.php

I am getting the following email from the host

ABS_PATH is not loaded. Direct access is not allowed.

Please advise how we can get this to run properly as it is not being run by server.

Our hosting provider believes this is PHP coding issue..

-- see below..

Hello ..

This is Alex Kr in Managed Hosting just following up. So I did a little more digging into the "ABS_PATH is not loaded. Direct access is not allowed." error. After a little more digging, this appears to be a variable that's defined in this PHP application and doesn't appear to be an environment variable that would defined for the user that runs that cron.php script. As far as I can tell, this variable is defined in the index.php file for this application. I'm not a PHP developer, but this excerpt from the head of that file, seems relevant:
define('ABS_PATH', str_replace('//', '/', str_replace('\\', '/', dirname($_SERVER['SCRIPT_FILENAME'])) . '/
'));

if(PHP_SAPI === 'cli') {
  define('CLI', true);
}

require_once ABS_PATH . 'oc-load.php';

Based on how this variable appears to be defined, this looks to me like it's part of this "osclasspoin.com" PHP application and not necessarily an environment variable or something else that we would be responsible for on the server-side. At this point I'm going to recommend that you reach out to a PHP developer to assist you with troubleshooting this issue related to running that cron script. Unfortunately, this issue does appear to be outside of our scope as system administrators and more in the scope of a PHP developer.

Let me know if you have any questions, or if there's anything else that I can assist you with. Thank you!
Best Regards,
Alex Kr.

*

MB Themes

Re: ABS_PATH is not loaded
« Reply #1 on: December 29, 2021, 08:37:50 AM »
Wrong file called in cron.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

karotu

  • **
  • 5 posts
Re: ABS_PATH is not loaded
« Reply #2 on: December 29, 2021, 09:24:20 AM »
So it should be like this?

/usr/local/bin/php /home/antXXXX/public_html/index.php

As per manual docs.osclasspoint.com/cron-setup

The whole cronjob should look like this

0 * * * * usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t hourly
0 0 * * * usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t daily
0 0 * * 0 usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t weekly

Please advise if correct..

Cheers

*

karotu

  • **
  • 5 posts
Re: ABS_PATH is not loaded
« Reply #3 on: December 29, 2021, 10:56:58 AM »
Hi,

Also, in the manual.. there is this section at the very end..

Different setups
Best case scenario
You are able to run one or many cronjobs. In that case, execute oc-includes/osclass/cron.php in your cronjob ‘each hour.’

Remember to uncheck Settings > General > Cron Settings > Automatic CRON processing.

This is the file I was getting the ABS_PATH error.. should we add this to our cron too?


Marked as best answer by karotu on December 29, 2021, 11:15:56 AM
*

karotu

  • **
  • 5 posts
Re: ABS_PATH is not loaded
« Reply #4 on: December 29, 2021, 11:13:37 AM »
Topic solved:

0 * * * * usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t hourly
0 0 * * * usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t daily
0 0 * * 0 usr/local/php5/bin/php /home/your_username/public_html/index.php -p cron -t weekly

Don't forget the -p cron -t hourly etc..

Thanks.

*

MB Themes

Re: ABS_PATH is not loaded
« Reply #5 on: December 29, 2021, 11:13:59 AM »
I think that message in docs may be outdated, will check it.
One you posted is correct.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots