Search code examples
phpsshsystemrequire-once

Call PHP document with SSH includes get variable


I have the following in a PHP document I'm calling from a cron job.

if (is_file($docRoot . $row['cron_action_script_path'])) {

    system("php " . $docRoot . $row['cron_action_script_path'] . $row['params']);
}

However, I'm getting the error Could not open input file: /path/to/file.php?params=1

But I am getting past the if statement is_file('/path/to/file.php')

So it looks like there's a problem with including get variables on SHH calls to PHP document.

Is there anyway around this? I need to be able to dynamically call my params in some fashion.


Solution

  • if (is_file($docRoot . $row['cron_action_script_path'])) {
        $_GET['params'] = $row['params'];
        include $docRoot . $row['cron_action_script_path'];
    }