tags:

views:

1134

answers:

2

Hey everyone,

I was just wondering how I use Ant to build my web applications that I have written in PHP? I've googled around a bit and I have seen that it is possible but there are not any examples of the basic idea or any advanced use for them. Can any of you help me out?

Thanks!

+1  A: 

While Ant itself is written in java, you can use it to build any kind of applications you want. Here's a basic tutorial and a full manual. Beyond that, you need to clarify what is it you want to do to get a more precise answer here.

Update (based on question clarifications):

Copying / moving files / folders is easy via Ant. Look through the "Hello World" tutorial I've linked above and Familiarize yourself with FileSet concept and Copy, Mkdir and Move tasks to get started. Here's another tutorial that shows how to set up a basic build (ignore java-specific stuff like javac/war).

Making changes to the database is an entirely different subject. If you have 'alter' scripts ready, you can use Ant's Exec task to invoke your DB's command-line client to run those scripts (though I probably wouldn't do it in production). If you want to use Ant to track those changes, then you're looking at the wrong tool. Liquibase can be used to do that and it seems to be getting a lot of traction lately. It's quite like Ant in the sense that it's written in Java but can be used in any environment. I'm no PHP expert so I wouldn't know if there's something more PHP-geared available.

ChssPly76
+5  A: 

This is definitely possible. If you are looking for a pure php solution phing might be what you want. Also note that there's usually no reasons to build PHP scripts. They should 'just work'.

Evert
I realize they should "just work," but I am working as a php developer this summer and I am pretty sure that my employer use ant scripts to prepare an update for the live site so I was just wondering how they did it.
TheGNUGuy