I have problem in executing exec() on browser.
I could run a php program that includes exec() using command line execution of PHP, the same program is not working from the browser.
Executing system commands through PHP code
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Executing system commands through PHP code
On command line PHP uses the userid of the person executing the code and thus, has those privileges. In a browser PHP runs under the userid of the HTTPd user and thus only has those privileges. Basically, check your permissions on the executable fileNewfriend wrote:I have problem in executing exec() on browser.
I could run a php program that includes exec() using command line execution of PHP, the same program is not working from the browser.
I checked out all those permission. Its proper.
I am giving u a smaple code where I exactly have the problem.
<?
exec("iptables -L",$out,$ret)
if($ret==0)
{
for($i=0;$i<count($out);$i++)
print(" $out[$i] ");
}
?>
This code is listing all the rules in iptables when executed from command prompt. But no output from browser.
I am working at root, I have all privilages.
Please help me.
I am giving u a smaple code where I exactly have the problem.
<?
exec("iptables -L",$out,$ret)
if($ret==0)
{
for($i=0;$i<count($out);$i++)
print(" $out[$i] ");
}
?>
This code is listing all the rules in iptables when executed from command prompt. But no output from browser.
I am working at root, I have all privilages.
Please help me.