Re: Error in exec function in php



In our last episode,
<3831602d-5e6e-41c8-a085-8f91dd8a10df@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, the
lovely and talented prasath_linux broadcast on comp.lang.php:

Hi friends,

I have problem in exec command in php,

I am trying to execute linux command,

rsync -avr /source_path /destination_path

This command is running in shell terminal prompt. But executing
this command through exec

exec('rsync -avr /source_path /destination_path');

in php file. This command in not running in php script.

Kindly notice the solution for this error.

Thanks in advance.

When php runs on a server, PATH is generally very restricted. You might
make this run by making the path to the command explicit:

exec('/path_to_rsync/rsync -avr /source_path /destination_path');



--
Lars Eighner <http://larseighner.com/> usenet@xxxxxxxxxxxxxxx
84 days since Rick Warren prayed over Bush's third term.
Obama: No hope, no change, more of the same. Yes, he can, but no, he won't.
.



Relevant Pages

  • Re: IIS 6.0 on Windows Server 2003
    ... If PHP insists on using CMD.EXE to execute the shellcommand on the ... server, then no, you have no choice -- you must give read permissions to the ... this would be a security vulnerability caused by PHP. ...
    (microsoft.public.inetserver.misc)
  • Re: exec() Silent Death
    ... trying to script that in PHP. ... an output parameter to the exec() call, ... i fyou hard coded the exec command and it works in a browser, ... //using single quotes because you dont need php to parse for special ...
    (alt.php)
  • XP exec background process
    ... I was trying to exec a background process on XP using PHP CLI, but could not get it to work. ... The "False" parameter causes the Run method to continue immediately without waiting for the command to finish. ... So I could make my PHP file exec a VBS file that does the actual background execution of my command. ...
    (comp.lang.php)
  • Re: exec() gives output??
    ... > I'd like to execute a command on the server ... > particular command takes a long time to execute, ... A successful call to exec() replaces the Perl script with whatever execis ...
    (comp.lang.perl.misc)
  • vbscript WshShell.exec call in ASP
    ... I have upgraded the WSH on the server to version 5.6 and am no ... My code is very simple - I'm just trying to get a simple exec call working ... No matter what command I ...
    (microsoft.public.scripting.vbscript)