Are there ssh and scp tasks for phing?

I would like to do a remote deployment from my build machine to the server. Remote access can be done using ssh commands from a script, but I would prefer to use phing and a deploy.xml file that will do the automation.

What alternatives do I need to do with ssh (and scp) tasks from phing build file?

+5
source share
7 answers

If you really need a finger, then afaik is only exec there. If you are open to other tools, take a look at capistrano and my answer in Setting up a PHP web project infrastructure. "

-2
source

SCPTask Phing:

scp. PHP SSH2.

+15

SCP SSH Phing. SSH2 PHP. . , , .

+9

, . exec, , xml.

<exec command="scp -i keys/id_rsa myfile user@$server:myfile" dir="." />
+5

For SemanticScuttle, we use rsync to deploy the release files to the SourceForge server - also through exec. Rsync understands ssh.

+1
source

For ssh, there is the ssh2 PECL extension, and then Phing has ssh and scp .

  • On Mac, install libssh2 via Homebrew. On Linux, use the package manager.
  • sudo pecl install pecl.php.net/ssh2-0.12

Now you can do this:

<?xml version="1.0"?>
<project name="test" default="test">
  <target name="test">
    <ssh username="vagrant" password="vagrant" host="192.168.123.456"
        command="pwd" property="pwd" display="false" />
    <echo>The current working directory is ${pwd}</echo>
  </target>
</project>
0
source

All Articles