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

phing -Dbuild.env=production
sftp -b sftpcommands.txt
ssh < sshcommands.ssh


cd  path/onthe/server


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

Running 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.


cd /path/tothe/build/folder