Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,096
    Thanks
    11
    Thanked 101 Times in 99 Posts

    weird shell script issue

    Hi, I am using PHP to build a string to pass to the OS using exec or system ..
    the long and the short of it is that $exec evaluates to ..

    $exec = "scp /some/file.txt user@domain.net:/some";

    which should scp file.txt to the remote host...
    but when I use exec() or system() I get the reply ..

    `cp: cannot create regular file `user@domain.net/some/file.txt``

    Its as though the 's' in scp is being ignored ? any ideas?
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)

  • #2
    New Coder
    Join Date
    Mar 2006
    Location
    São Paulo, Brazil
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This occurs probally because you don't have SCP access on the OS.
    Or, you don't have permission to write files in this place. You should check your permissions to this place to write files in it.

    In terms of php coding, if you're trying to write files in a remote place, I think you should create the file first and then put the file there using FTP functions. Executing shell commands is generally not recomended because security issues.

    Maybe this link can help you...

    http://www.nabble.com/Scp---sftp-wit...-t2625939.html

    ----
    As coisas mais simples são as mais importantes.
    ---------
    Thompson M1A1: D-Day
    ----------------

  • #3
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,096
    Thanks
    11
    Thanked 101 Times in 99 Posts
    Hi, I can scp from the command line, I do it all the time .. and I was just writing a wrapper to save typing out all the paths etc and decided to do it in PHP rather than a shell script.

    It appears that 'scp' is being converted to 'cp' in which case the error would make sense, but I do not see how or where 'scp' gets changed to 'cp'
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •