Windows and installation gotchas

Just been helping out a mate trying to get Phing and SVN tasks to run properly on windows.

Here's a few things we've found that I'd like to share in the event people have similar problems.

If you installed the subversion binary under C:\Program Files, you will need to quote the SVN path in SvnBaseTask.php, eg:

private $svnPath = "\"C:\\Program Files\\subversion\\bin\\svn.exe\"";

I've found the escape shell command doesn't work properly in Windows (or maybe I've just not investigated it enough), so in PEAR\VersionControl\SVN.php I had to set the use_escapeshellcmd property to false.

var $use_escapeshellcmd = false;

I don't recommend this for a production server without further security investigations but it's ok for your local dev box.

The next hickup is your output folder. It won't work with a folder name with a space in it, eg:

C:\Program Files\eclipse\workspace\dev_portal> phing joomla

because the command line will look like:

"C:\Program Files\subversion\bin\svn.exe" export --username XXX
--password XXX --force --non-interactive
http://scm.XXX.com/scm/JoomlaSpace/1.5 C:\Program
Files\eclipse\workspace\dev_portal

Of course the space in Program Files will be taken as extra arguments.

My system was working because the svn binaries and the project folder are, respectively:

C:\svn\bin\svn.exe
C:\Apache2\htdocs\projects\project_folder

If anyone has any additional workarounds for these issues I'd welcome the advice, otherwise it might be worth including as an FAQ in the docs.

Oh, and just a note on installing phing. Here's what I do to get everything needed. If there is a better way please let me know, otheriwise this might help some people:

$ pear channel-discover pear.phing.info
$ pear install --alldeps phing/phing
$ pear install --alldeps channel://pear.php.net/VersionControl_SVN-0.3.0alpha1
$ pear install --alldeps channel://pear.php.net/PhpDocumentor-1.3.0RC6
$ pear install --alldeps http://creole.phpdb.org/pear/creole-current.tgz
$ pear install --alldeps http://creole.phpdb.org/pear/jargon-current.tgz

It's the same on windows providing PEAR is set up properly on your install.

Andrew Eddie


"Cannot redeclare class" solution

In a nutshell, the problem was "Cannot redeclare class" errors being caused by files including things from both the testing directory (build target) and the current working directory (sandbox).

The solution was to add the following line to my build.xml file:

<includepath classpath="${build.target.dir}:${php.classpath}" />

This simply made my target directory take precidence over my current working directory. Ideally the cwd would be completely excluded but I haven't figured that one out yet, so I'll leave that as an exercise left up to the reader ;)

Harlan Iverson