K
K
khodos_dmitry2019-02-28 10:37:29
PHP
khodos_dmitry, 2019-02-28 10:37:29

Why doesn't __DIR__ work when running a script via cron?

If you run through the browser, then the script fully works.
The file is loaded in this way:
require_once __DIR__ . '/../../../../wp-load.php';
But, for some reason, there is an error in cron at this point. How to be in such a situation?
And, maybe someone knows how to make cron show errors? error_reporting(E_ALL); - Does not help.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Adamos, 2019-02-28
@Adamos

Strongly old version of PHP? __DIR__ has been introduced since 5.3 if I'm not mistaken.
CGI may run a different version of puff than the web server.
Cron sends error output to the mail, if configured.
If you have a local server without configured mail - see /var/mail

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question