1

Here's my code to create a new at job...
system('echo \'php -f /path/to/my/php/file.php\' | at 1700');

I thought this would be simple and would just work but alas, nothing happens!

When I run echo \'php -f /path/to/my/php/file.php\' | at 1700 via ssh everything works as expected.

Is this a permissions problem? I.e PHP isn't allowed to create new at jobs?

hlovdal
  • 23,353
  • 10
  • 78
  • 148
Sam
  • 4,217
  • 11
  • 38
  • 59

1 Answers1

1

Just FYI you have to make sure that you are allowed to execute system commands from your PHP scripts.

A lot of servers have this feature disabled.

However, if you want to turn this back on I believe you can do so in the php.ini file, you would have to turn safe_mode to off.

When allowing user-supplied data to be passed to this function, use escapeshellarg() or escapeshellcmd() to ensure that users cannot trick the system into executing arbitrary commands.

If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends.

Note: When safe mode is enabled, you can only execute files within the safe_mode_exec_dir. For practical reasons, it is currently not allowed to have .. components in the path to the executable.

DarkMantis
  • 1,468
  • 4
  • 19
  • 39