That's because the current working directory of the script is not the same when called via cron. (I assume it is /
, the root directory)
Change the require_once
to:
require_once __DIR__ . '/myincludefile.php';
__DIR__
will always contain the directory where the current script is located - not the current working directory. That´s why it is handy to build relative paths.