build PHP with ant scripts

后端 未结 4 1037
天命终不由人
天命终不由人 2021-02-14 01:38

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

相关标签:
4条回答
  • 2021-02-14 02:12

    We use ant to 'build' php apps. At it's most basic, the ant script just copies the file into the folder on the testing webserver (localhost in my case).

    Why do this? well there's not a great deal of point to it, but it is a handy way to avoid putting .svn files into the webserver. If you want to change the location of the webserver you can just build to the new location. You can also do different things according to whether you're on Linux or Windows for example, but I've never used that side of it.

    0 讨论(0)
  • 2021-02-14 02:18

    Having tried Phing, Ant and Gradle, I would strongly recommend gradle. Here is a bit of description Choosing tools for PHP application automation

    0 讨论(0)
  • 2021-02-14 02:28

    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.

    0 讨论(0)
  • 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'.

    0 讨论(0)
提交回复
热议问题