Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

build PHP with ant scripts

Tags:

php

build

ant

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!

like image 615
cskwrd Avatar asked Jul 20 '09 16:07

cskwrd


2 Answers

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'.

like image 186
Evert Avatar answered Sep 29 '22 15:09

Evert


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.

like image 39
ChssPly76 Avatar answered Sep 29 '22 17:09

ChssPly76