Results 1 to 6 of 6
How to run shell script from PHP code with username as parameter???
and
how to run exe from shell script????...
- 09-19-2011 #1Just Joined!
- Join Date
- Jun 2009
- Posts
- 22
Run shell script from PHP
How to run shell script from PHP code with username as parameter???
and
how to run exe from shell script????
- 09-19-2011 #2Just Joined!
- Join Date
- Sep 2011
- Posts
- 52
You can run using the passthru(); function. If you want to run it as some user you can add sudo -u username before the command.
What do you mean by "run exe from shell"?
- 09-20-2011 #3Just Joined!
- Join Date
- Jun 2009
- Posts
- 22
Run Executable file from shell script
i want to run executable file (i.e., maildirmake which is used to create mailboxes ---- maildirmake /var/postfix/maildirs/username. Path of maildirmake is /etc/maildrop-2.5.4/maildir/maildirmake) from shell script.
How to do this???????
- 09-20-2011 #4Just Joined!
- Join Date
- Sep 2011
- Posts
- 52
It would be like this:
passthru("sudo -u someusername /path/to/somecommand somevariables etc");
- 09-20-2011 #5Just Joined!
- Join Date
- Jun 2009
- Posts
- 22
Running shell script from php
hi,
iam running shell script from php.
The path of shell script is /root/myscript.sh.
1) when u give "exec(sh /root/myscript.sh)" in sample.Php
it is not working.....???????
2) but when u copy myscript.sh in /var/www/html
and give like "exec(sh myscript.sh)" it is working fine as apache user & group.
But i want different owner & group.
SO, I prefer 1 option.
"exec(sh /root/myscript.sh) is not working?????
How can i do????
- 09-21-2011 #6Just Joined!
- Join Date
- Sep 2011
- Posts
- 52
I believe apache can't get to /root because of permissions.
Try:
chmod 755 /root
This will however make the contents of /root accessible by anyone which is insecure


Reply With Quote