Configure, Package and Deploy PHP applications using Phing and SSH

Alternative method to Teamcity, we can use simple batch files to run the phing commands and other ssh commands.

We will configure and package php application and deploy to the cloud using ssh protocol. We will use Phing tool to build the package and then use sftp and ssh commands to deploy to the server.

First download or install Phing binaries from the web. If you have manually downloaded phing binaries, you have to install it correctly so that it is accessible from terminal.

Phing utilized build.xml and other configuration files to build your project. To learn how to crete build file go to the following link

Configure, Package and Deploy Php projects : TeamCIty Part 1

deploy.sh

phing -Dbuild.env=production
sftp -b sftpcommands.txt user:host.com
ssh user:host.com < sshcommands.ssh

sftpcommands.txt

cd  path/onthe/server
put php.zip

sshcommands.ssh

cd path/to/zipfile
unzip -o php.zip
echo "Finished unzipping file"

Running deploy.sh command on the terminal will run the phing to build the project and will upload to your cloud and then explode to the appropriate location.

Terminal

cd /path/tothe/build/folder
sh deploy.sh

Like us

See also

Configure, Package and Deploy Php projects : TeamCity Part 2

In this part we create build configurations to actually make use of build files on the previous article and deploy to the cloud using ssh commands.

Configure, Package and Deploy Php projects : Part 1

Configuring , packaging and deploying is often tedious process. In this series of article we will learn about how to make automate this tasks.

MSBuild integration on Cruise.Net

Here is the basic steps on how to integrated msbuild task on open source cruise.net to automatic your visual studio builds.