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
phing -Dbuild.env=production sftp -b sftpcommands.txt user:host.com ssh user:host.com < sshcommands.ssh
cd path/onthe/server put php.zip
cd path/to/zipfile unzip -o php.zip echo "Finished unzipping file"
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.
cd /path/tothe/build/folder sh deploy.sh