I was trying to interact with my subversion repositories using PHP yesterday and I knew that PECL has a extension named “SVN” for PHP users. So I tried to install in in my machine by when I tried to install it with the following command it always failed saying “unable to locate svn_client.h”
sudo pecl install -f svn
Then I googled for some time to find out which package actually and I found that it is a part of libsvn which I didnt install in my machine which has ubuntu 7.10. so I found the appropriate package using the following command and it obviously locate the appropriate lib to install, which is “libsvn-dev”
sudo apt-cache search libsvn
After that I just installed it via the standard procedure “sudo apt-get install libsvn-dev
” and then tried to install the pecl extension once again. And whoa!, it works.
Here’s a small snippet to find out the difference of a single file from the repository under two separate revisions. in the following example svn_diff function returns two streams. one of them contains the difference and another one contains the error block.
<?php
list($diff,$error) = svn_diff("http://orchidframework.googlecode.com/svn/trunk/app/config/configs.php",
52,
"http://orchidframework.googlecode.com/svn/trunk/app/config/configs.php",
61);
echo "<pre>";
fpassthru($diff);
?>
Easy, huh?