php exec() doesn't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fredass
Forum Newbie
Posts: 12
Joined: Tue Apr 06, 2010 4:18 pm

php exec() doesn't work

Post by fredass »

i want to execute comand crontab [file] from php code, but there no result. The crontab is not changed and no error message is return.

Code: Select all

$cronresult = exec("TERM=xterm /var/www/vhosts/xxx/httpdocs/system/application/views/newjob");
also tried to put that command to script and execute script. The result was the same: crontab is not changed and no error message returnd.

Code: Select all

$cronresult = exec("TERM=xterm /var/www/vhosts/xxx/httpdocs/system/application/views/temp.sh");
The script:
#!/bin/sh
crontab ./var/www/vhosts/xxx/httpdocs/system/application/views/new_cronjob

When I execute that script from terminal it works - crontab is changed.
Also tried to execute simple commands from php such as ls and it worked.

Any ideas?
Post Reply