3

I keep getting:

failed to open Stream: No such file or directory " Path " on line 2

When I try to run this php file from the command line.

require_once 'modules/Reports/ScheduledReports.php'
VTScheduledReport::runScheduledReports($adb);

I have checked to see if the file is there and there is a class called class VTScheduledReport in ScheduledReports.php and the function runScheduledReports. Is there. The function looks like this:

public static function runScheduledReports($adb) {
    require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';
    $util = new VTWorkflowUtils();
    $adminUser = $util->adminUser();

    global $currentModule, $current_language;
    if(empty($currentModule)) $currentModule = 'Reports';
    if(empty($current_language)) $current_language = 'en_us';

    $scheduledReports = self::getScheduledReports($adb, $adminUser);
    foreach($scheduledReports as $scheduledReport) {
        $scheduledReport->sendEmail();
        $scheduledReport->updateNextTriggerTime();
    }
    $util->revertUser();
}

Anyone have any idea why this won't run?

peterh
  • 11,875
  • 18
  • 85
  • 108
LL.
  • 129
  • 1
  • 12

1 Answers1

6

change

require_once 'modules/com_vtiger_workflow/VTWorkflowUtils.php';

to

require_once (dirname(__FILE__) . '/modules/com_vtiger_workflow/VTWorkflowUtils.php');

if your include file path is relative to the script. dirname(__FILE__) return the full path of the file from where it is called.

for the ScheduledReports.php you can use the following

require_once (dirname(__FILE__) . '/modules/Reports/ScheduledReports.php');
bansi
  • 55,591
  • 6
  • 41
  • 52