Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I want to copy file from remote machine to local machine using PHP.
On both machines Linux operating system present.

The code is

$result=shell_exec("scp admin@
conn /opt/lampp/htdocs/upload/");

This function return nothing & file is not copied.
If I use above parameter on konsole , it copy successfully.

Please, guide me.

Re: shell_exec

pradeep wrote:

Quoted text here. Click to load it


Could it be a permissionproblem?
PHP runs as 'www-data' or 'apache', or' nobody'.
To debug you could try the following:
1) log in as the user PHP is. (Use touch somefile from PHP on some wideopen  
directory to check if unsure)
2) give the command in Konsole

Does THAT work?

If yes, well, I would advise you to catch the output produced by the  
Use passthry() to catch the output. Maybe it contains some error that helps  
you fix the problem.

Erwin Moller

Re: shell_exec

Erwin Moller wrote:

Quoted text here. Click to load it

[typo correction]
That should have been passthru(). :-)

Quoted text here. Click to load it

Re: shell_exec

On 1 Mar, 09:51, Erwin Moller
Quoted text here. Click to load it

If its running as a different user it will be looking in a different
place for the private key to connect.


Site Timeline