Question itself in
__ dir __ This constant points to the directory in which is that?
Answer 1, Authority 100%
This is the directory of the file in which the code is currently executed:
/ var / www / test-app / index.php: & lt;? php echo __dir__; // / Var / WWW / Test-App
/ var / www / test-app / subdir / sub-test.php: & lt;? php echo __dir__; // / Var / WWW / TEST-APP / Subdir
__ file __ Similarly will return the path to the currently executed file (i.e.
Basename (__ File__) === __dir __ )
Answer 2, Authority 44%
__ dir __ Returns the script directory.
For example, you have a script
/usr/www/site/html/index.php . You write in it
__ dir __ return the path of the folder in which this script is located,
/ usr / www / site / html
If you put your script on CRON and your paths will be without a constant dir and analogs, then the script does not find the necessary files. Although with manual launch everything will be OK.