PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHP and Me Blog: Use Phing to Update your SVN-Version-Controlled Website Automatically, Through FTP

Note: This article was originally published at PHPDeveloper on 19 April 9035.
PHPDeveloper

On the "PHP and Me" blog there's a new entry from Pinpin Bysma showing how to use the PHP-based deployment tool Phing to update your production website via an FTP connection, automated by a Phing build.

If you're working on a PHP project, like with any other project, probably comes a time when you need to "build a new release," e.g. update the production web site with the latest version of the code. And doing the whole thing manually isn't the most efficient way to get things done, especially if you're lazy, or have to do that every once in a while, over a long period of time. [...] Obviously if updating the site itself could be done without FTP but through a simple svn switch, things would be easier. Still, Phing would allow to make things easier just as nicely. It could for example still be used to create the new tag, trigger the switch, etc

He introduces the process by showing a basic Phing build file that uses the PEAR VersionControl_SVN component to get the latest from the repository and push it to another directory. There was one thing that he wanted to do that the default SVN task couldn't - export the difference between two tags. To make this happen, he had to extend Phing and make a new task - SvnExportDiff. He includes the code for this new task and an updated build file to show it all in use - complete with the FtpDeploy to push the code live.