For my web application running on LAMP, I need to be able to deploy database migrations and code changes on multiple servers and be able to test deployment afterwards, all of this automatically done by scripts.
Currently I'm torn between using directly my build tool (Phing) with some special deployment/test tasks, or shell scripts, or a scripting language like Ruby or Python.
The problem is that I feel that a build tool should be used to build, not to deploy. I also feel that shell scripts are hard to maintain and not very readable.
Do you have any good advice on this subject ?
For PHP projects, Phing is the way to go. Deployment is definitely one of its intended usage, considering that in PHP there isn't any "real" build process - as scripts are not compiled.
From the official site:
If you find yourself writing custom
scripts to handle the packaging,
deploying, or testing of your
applications, then we suggest looking
at the Phing framework.
Phing can do everything shell/python/ruby scripts can do, and can be extended in PHP which is its major draw for PHP developers. Why would you want to use ruby/python if you are a PHP developer?
Rasmus Lerdorf (creator of PHP) released a deployment tool called WePloy.
A lot of people here on stackoverflow seem to really like Capistrano.
To deploy web applications, PHP or other, in some click, you can use fredistrano.
What have I used?
svn post-commit hook
shell script to rsync
perl cgi script to svn switch across systems
It doesn't seem like any of these would be acceptable for you though, given your statement "I also feel that shell scripts are hard to maintain and not very readable."
Personal script which uses
Svn export + rsync
Related
Is there a good, simple solution for PHP "one-click" deployment to a production server? And also with a functionality to reverse back if needed.
In particular, I am interested in this with regards the PHP code itself. But if you know a good solution for MySQL, it is also welcome.
For deploying easily, we use Capistrano (its a Ruby tool, but deploys anything really) and its great, just need
cap deploy
from the command line (at its simplest)
If you want something written in PHP I can't name any I'm afraid.
For MySQL, I guess you would need some kind of migration tool, or build your db changes into SQL files that can be run by your deployment script.
I have developed a PHP web application, but a client insists on a real Windows application, since he doesn't like running the software inside a browser.
Are there any solutions for this, any compilers to turn a web project into a Windows exe ?
I have looked at Phc-Win , but that seems more suited for small command line utils, not for entire web-applications...
UPDATE:
just found this myself, both look quite promising...
http://www.zzee.com/phpexe/
http://www.exeoutput.com/index.php
There's no tool for this, short of a simple wrapper app that embeds a browser inside an otherwise normal application window. Your PHP app would have to be completely re-written to include ALL of the overhead code necessary to build a GUI - basically all the 'display' stuff that a browser does automatically, would have to added to your app.
Well some of you did not google good enough:
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
Supports most of the "web-languages" to write native Applications.
Tutorial Reference for Appcelerator: http://appceleratortitanium.com/tutorials/3-appcelerator-titanium-tutorial-beginners.html
Quote:
"Q: What languages can I use to make desktop apps?
A: Javascript, PHP, Python, Ruby, HTML, HTML5, and CSS."
Not exactly what you are looking for: http://www.roadsend.co/home/index.php?pageID=compiler
You may look into "HipHop" (made by Facebook): Converts PHP to compileable C++-
There's a tool for this. :-) I never used it but you can try this: Winbinder.
It is simple to compile your PHP source code into an executable. Facebook released a compiler for PHP in early-2010, called HipHop, which aims to create C++. You could then compile this code, for example using gcc, to machine-code.
The more difficult point for a complex Web-App like yours is the user interface. When compiling the way I described above, the application can be run from command line - this might work for simple tasks, but not, if your application returns HTML.
One possibility to solve this problem is PHP-GTK. PHP-GTK is a API for GTK (the graphical user interface used by Linux Ubuntu by default), written in PHP. Using this solution would have to read some documentation about this API, and you would need to rewrite some parts of your program, but it would probably be the most beautiful solution, because it would create a "native" experience.
Another possible solution could involve Adobe AIR, which lets your create programs for the desktop, using HTML, CSS and JavaScript, but I don't know if and how this would work together with your compiled PHP.
Please also note that it isn't absolutely necessary to compile your PHP for it to run on the client's computer; You could also ship the PHP-interperter right with your (uncompiled) PHP-script. Of course, compiling brings benefits, such as faster execution of the program.
-- André
I've been wondering. Is it possible to use php to create applications apart from just websites. If yes, whats the simplest resource?
PHP can be used from the command line like you would Python or Perl.
With an extension like PHP-GTK you can add GUI functionality to applications as well.
Although I'd generally recommend other languages to do more general scripting, and especially GUI type apps, PHP can be used to build general purpose scripts and apps.
more info on shell scripting with PHP
Using PHP-GTK to build GUI apps.
Yes, PHP is a general purpose scripting language but was originally designed as a server side scripting language and that shows (e.g., the <?php tag). Details are available on the official site http://www.php.net/docs.php
You can do command line scripting and windowed apps (with GTK).
http://gtk.php.net/
PHP's largest asset is probably its integration with Apache so it is 'meant' to be used for web applications. But there are other uses. For example, I use PHP through the command line ever day to administer Drupal websites, through a program called 'Drush' (Drupal Shell). You can Drush see at http://docs.drush.org/. Drush is a bash wrapper for a PHP application that bootstraps Drupal and make changes to the database, as well as interact with the file structure and CVS repository. Granted, the reason it is written in PHP is because Drupal is written in PHP, but there is no web interface. Hopefully that is a helpful real world example?
I'm doing PHP development and I'm thinking of using one of these. I have both PHP and Java installed on my machine. In theory I could use any of the two.
What are the compelling arguments to pick Phing over Ant?
The greatest argument I have in favor of Phing is that it's fully developed in PHP ; which means, at least :
You can debug it / submit patches if you want
You can develop tasks in PHP
including tasks which are specific to your project
that can use stuff from your project (I've written a couple of tasks that use functions of Drupal, in a drupal-based project)
And, if you are working on a PHP project, your team probably knows PHP well -- while they might not know Java
No need to install Java on your servers
The main argument (for me) for using Phing when doing PHP development is
staying inside the PHP Ecosystem.
When using Phing on shared hosts, you can be sure it works when PHP works.
And you can easily extend Phing with your own task in PHP.
And since it's a PHP tool you will sometimes find it in other applications as well.
We currently use a hand-rolled setup and configuration script and a hand-rolled continuous integration script to build and deploy our application. I am looking at formalizing this somewhat with a third party system designed for these purposes.
I have looked into Phing before, and I get that it's basically like Ant. But, my Ant experience is somewhat limited so that doesn't help me much. (Most of the Java work I have done was just deployed as a jar file).
I have looked into Cruise Control before, and I understand that phpUnderControl is a plug-in for CC. But, Phing says it also works with CC. So I am not clear on the overlap here. Do I need both Phing and phpUnderControl to work with CruiseControl, or are they mutually exlclusive?
What I need exactly is something that can:
Check out source from SVN
Install the database from SQL file
Generate some local configuration files from a series of templates and an ini file
Run all of our unit tests (currently ST, but easy to convert to PHPUnit) and send an email to the dev team if any tests break (with a stack trace of course)
Generate API documentation for the application and put it somewhere
Run a test coverage report
Now, we have just about all of this in one form or another. But, it'd be nice to have it all automated and bundled together in one process.
phing is pretty much ant written in PHP where phpUnderControl adds support for PHP projects to CruiseControl and uses phing or ant on the backend to parse the build.xml file and run commands.
I just set up CruiseControl and phpUnderControl and it's been working great. It checks out my SVN, runs it through phpDocumentor, PHP_CodeSniffer, and PHPUnit whenever we do a check in. Since it's all based off of the build.xml file you can run just about any software you want through it.
I'm sure lots of people will say this by the time I've typed this but...
I know it's not PHP but we're finding Capistrano just the job for this kind of thing. It really is an excellent piece of software.
We've been using Phing, and the cost to set it up has been very low; it's really easy to learn even if you don't know ANT. I've had very bad experiences with CruiseControl (instability - going down randomly) - so I like the simplicity of Phing. Plus, it's easily extensible using PHP (in case you have a custom task that they don't support out of the box).