Search code examples
phpphpstormphing

Phing Slow on Simple Tasks


I've been changing my deployment processes to use Phing rather than typical FTP/SCP upload of files.

However I'm having an issue with Phing being very slow. Copying a not very large file structure takes way longer than command line tools would. So does tar bzip2 and other tasks.

I do have PHP Xdebug turned on, but surely that won't cause it. Turning Xdebug off made no difference. I am running Phing via PhpStorm. Any ideas on how to speed up Phing?


Solution

  • So turns out I was barking up the wrong tree.

    The problem was my Phing build was recursing. My build directory was within a directory getting copied and tar.bz2'd by phing. So each time I ran it there was another copy of my entire site recursively getting added to the build directory. This meant there were way too many files compared to what there should have been. It was also eating my hard drive and I was wondering why. It should have been obvious.

    Here's what I've added as my first task to all build processes:

    <!-- ============================================  -->
    <!-- Target: clean                                 -->
    <!-- ============================================  -->
    <target name="clean">
        <echo msg="Cleaning ./build" />
        <delete dir="./build" includeemptydirs="true" failonerror="false" />
    </target>
    

    That's been added as a dependency to my first process. So there was nothing wrong with my environment, it was just Phing doing exactly what I told it to do.