I have a script .sh with a curl
command in it:
curl --digest "http://xxxxxxx.xxx/mail.php?email=xxxx@xxx.xx";
from terminal this works good :
./script.sh
//(mail arrives in my box)
from php
this works good:
shell_exec('./phpsc.sh');
// (mail arrives in my box)
from terminal this works good:
at -f phpsc.sh now + 5 minute
// (job created, mail arrives in my box after 5 minutes)
from php
this won't work:
shell_exec('at -f phpsc.sh now + 5 minute');
//
even when I put at
command in script and run the script from php
the at
command it will be ignored
joker
June 9, 2016, 2:53pm
2
What's in the log.txt when you execute this?
shell_exec('at -f phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');
...and i think correctly it is called +5 minutes (s at the end).
1 Like
By "from PHP" you really mean "when run by the web server through CGI", yes?
Your web server will likely be running it as the apache user and group, which may not be in at.allow, and may not have write-access to the folders you wanted.
1 Like
corona688:
By "from PHP" you really mean "when run by the web server through CGI", yes?
Your web server will likely be running it as the apache user and group, which may not be in at.allow, and may not have write-access to the folders you wanted.
Please answer my question.
1 Like
yes from a browser, php and apache are installed on my VPS debian 7
at comand not allowd ?? how can i slove that sir
---------- Post updated at 03:03 PM ---------- Previous update was at 02:58 PM ----------
extra93:
yes from a browser, php and apache are installed on my VPS debian 7
at comand not allowd ?? how can i slove that sir
i have cheked php.ini and not found 'at' on the not allowed comand list
joker
June 9, 2016, 4:11pm
7
Hi extra,
if you execute the command I wrote before, you'll get an error message, which will help you to figure out your problem.
extra93:
yes from a browser, php and apache are installed on my VPS debian 7
at comand not allowd ?? how can i slove that sir
Run the command stomp gave you and tell us what it says.
oh sorry STOMP yes i tried but no file exist in /tmp/ or am i wrong on somethings ?
'at' cammand always ignored from php even when i put 'at' comand in script and run it from php at camand ignored and the reste of code works,
one more time sorry for my english
joker
June 9, 2016, 5:49pm
10
Obviously something is wrong....
You can check file permissions. Maybe your script has no access to /tmp. Please post the output of the following commands:
ls -ld /
ls -la /tmp
Maybe you typed in my command not 100% exact as I typed it here? I suggest you to double check it and copy&paste it here in. Maybe there's error.
Please always use code tags for code, input files, or command output. That's this icon:
...and as a very likely issue that will be present here: please use absolute path names! Instead of this...
shell_exec('at -f phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');
...use this...
shell_exec('/usr/bin/at -f /path/to/your/script/phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');
Have a look at your php.ini too. Especially at the setting disable_functions. Maybe shell_exec is listed there?
1 Like
joker:
Obviously something is wrong....
You can check file permissions. Maybe your script has no access to /tmp. Please post the output of the following commands:
ls -ld /
ls -la /tmp
Maybe you typed in my command not 100% exact as I typed it here? I suggest you to double check it and copy&paste it here in. Maybe there's error.
Please always use code tags for code, input files, or command output. That's this icon:
...and as a very likely issue that will be present here: please use absolute path names! Instead of this...
shell_exec('at -f phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');
...use this...
shell_exec('/usr/bin/at -f /path/to/your/script/phpsc.sh now + 5 minute >/tmp/log.txt 2>&1');
Have a look at your php.ini too. Especially at the setting disable_functions. Maybe shell_exec is listed there?
Ooh Thank you bro this realy helps me, here is what i get in LOG.TEXT:
from terminal:
warning: commands will be executed using /bin/sh
job 56 at Thu Jun 9 23:34:00 2016
from php (shell_exec):
You do not have permission to use at.
---------- Post updated at 05:44 PM ---------- Previous update was at 05:33 PM ----------
in /etc/at.deny i have this user list or i don't know what, the permission probleme come frome here i think ???
alias
backup
bin
daemon
ftp
games
gnats
guest
irc
lp
mail
man
nobody
operator
proxy
qmaild
qmaill
qmailp
qmailq
qmailr
qmails
sync
sys
www-data
joker
June 9, 2016, 7:01pm
12
There's a manual page for that file...
man at.deny
1 Like
i have find the solution thank you guys,
i removed www-data from /etc/at.deny and now 'at' comand works fine from php (sell_exec)
i hope this topic help another one
1 Like
rovf
June 10, 2016, 12:37am
14
extra93:
yes from a browser, php and apache are installed on my VPS debian 7
at comand not allowd ?? how can i slove that sir
---------- Post updated at 03:03 PM ---------- Previous update was at 02:58 PM ----------
i have cheked php.ini and not found 'at' on the not allowed comand list
You looked at the wrong place. See http://linux.die.net/man/5/at.allow .