As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
After reading the "Modern PHP workflow" article in the November 2008 edition of php|architect magazine which
discussed unit testing (phpUnit), build tools (Phing) and continuous integration (Xinc), I'm inspired the learn more about some of the tooling available for PHP, especially Phing.
In the past I've often handled deployment to a production server by running the live site as a subversion working copy and simply running an "svn update" on the production box to deploy the latest version of the code.
Do you use build tools for PHP code? What advantages you you believe they offer over deploying direct from subversion? What should I look out for, or what gotchas might I face?
I have used both Phing and Ant and prefer the latter much more. I initially went with Phing due to it being written in PHP but to be honest it isn't as mature as Ant. In the end, having a mature buildsystem with a large community is worth more.
Things done with Ant/Phing:
From a base checkout loalize to a specific language, ensure dependencies are there (other libs, directories, etc)
if you have them, compile templates, etc
Bring target database up to the required version, depending on the checked out code version
run unit tests, etc
A large issue that I see with Phing is that it creates a needless layer of indirection. PHP is a scripting language, and therefore could be run directly. Phing's use of XML configuration is a poor fit for the language: it does provide a more readable declarative configuration, but at the cost of sacrificing any of the flexibility of the language. With Ant (the inspiration for that route) it makes sense since Java did not have that flexibility as it is less dynamic and requires compilation.
Unfortunately I haven't seen many good alternatives in the PHP space, and unlike other languages build tools are not as essential or a part of the culture so the evolution of another well supported option may not happen any time soon.
I'd therefore stick to options that are closer to what PHP could do from cultures that more aggressively support build tools. I normally use Gradle. Rake also does a great job depending on with which language you want to cheat (and there may be other similar options). You should also weigh things like Webdriver support if you're into that type of thing. Otherwise creating a lightweight solution using PHP and/or BASH should cover everything while maintaining transparency
I looked at at Phing at it looks pretty awesome. For the project I'm working on I'm actually using Apache's Ant. I use it to do a several things:
Combine and compress Javascript and CSS (compression done using the YUI Compressor
Replace standard config files with production config files (e.g. rename config.php.production to config.php)
Remove un-needed files (such as the ant build file, build.xml)
I think Phing is worth looking at over Ant because it's native PHP, which could be nice. Also if you are doing anything more than just copy/moving files around look out for performance issues when you move to the production environment. I had an issue where the YUI compressor ran fine on my local machine but on the relatively small VPS it was super slow.
On a project I'm working on now we're using phpUnderControl to run tests and get fast feedback when something's broken. We plan to use it to run other tests as well such as some written in Watir.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
We have a website that originated in 2001, which started with some simple classic ASP scripts that enabled website viewers to dynamically configure products by following a step by step process of choosing product accessories, etc, using Access as the data source. The website expanded eventually to currently keep track of a simple, small encrypted member list with usernames and passwords to enable access to restricted areas of the website.
In the future, we're planning an expansion of the website and the backend will need an overhaul obviously to a more modern, scalable framework. The first inclination is to convert the classic ASP VBscript to VB.net. Another option would be to convert the backend functionality using PHP and MySQL.
Which would be easiest to convert to, simplest to maintain and scalable for a future expansion of functionalities?
It is a matter of preference and what the team is comfortable with. If you are better aligned towards ASP then stick to that and vice virsa. There is no 'right' answer or 'right' language for the job. They both do practically the same thing albeit in different ways.
There's lots of answers. If you already have developers, then a heavy influence would be what they are comfortable with.
If you don't already have a team, then there's lots of factors to consider. You need to learn the different languages, frameworks, platforms, & databases.
Languages. This is the set of core commands that the computer recognizes. Big ones are:
VBScript
VB.NET
C#
PHP
RUBY
Frameworks. Frameworks are large libraries that do a lot of the work for you. The core of the framework will still be one of the above languages, but there are also commands that call library routines. Big ones are:
ASP.NET & ASP.NET MVC (runs VB.NET, C#.NET, & other samller languages)
CAKE (runs PHP)
Ruby on Rails (runs Ruby)
Platforms. This is the type of server running your website. The two big ones are:
Windows (can run almost anything)
Apache (can not run MS products like ASP.NET)
Databases. Several good options here. Big ones are:
MS SQL Server (requires license to be purchased, and also requires
Windows)
MySQL (Free license)
MS Access (wouldn't recommend for anything but the smallest of
projects)
There are many, many more that could be listed. I tried to hit all the big ones.
Now, with all that being said, Ruby on Rails (RoR) is the most used for new development right now (according to Google trends). Lots of online libraries & help can be found.
PHP is huge, but is declining.
If you use ASP.NET, I would recommend using MS SQL Server as the a lot of the wizards fail when using MySQL.
If you use PHP, CAKE, or RoR, then MySQL would probably be more compatible with existing libraries.
Good luck with your upgrade.
IMHO PHP is equivalent to Classic ASP for many reasons, including that it is a scripting language. If you are going to move away from Classic ASP, rather than move horizontally, I would progress by choosing .Net or Ruby.
PHP is the easiest language for writing websites and it does not lack any needed features. Development is faster and cheaper with PHP. There are more PHP coders than .NET on account of the easy learning curve. Other languages may be "faster", but unless you have a very very large scale application this speed difference is irrelevant.
You will probably be making your site from the ground up and the difference in effort to "convert" your code won't matter.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I finally decide to give a source control a try with my existed project (since I will be hiring another new developer soon). I am pretty new to this area and I need recommendation which Source Control should I use to fix my current project.
I am developing Web Application which dealing with large number of pictures. Currently, we have over 500,000 pictures (large size picture and several thumbnails). I am using PHP which is not what I concern (since it is just only hundred of script files). My major concern is with the large amount of picture.
NOTE:
I just install VisualSVN. What do you think about SVN. Do you think it will fix to my requirement?
I got two votes to close this question. I did read the FAQ and I believe my question is perfectly fine.
Stack Overflow is for professional and enthusiast programmers, people
who write code because they love it. We feel the best Stack Overflow
questions have a bit of source code in them, but if your question
generally covers …
a specific programming problem
a software algorithm
software tools commonly used by programmers practical,
answerable problems that are unique to the programming profession
… then you’re in the right place to ask your question!
Stay away from legacy version control software such as CVS and SVN.
Use one that you can easily host yourself, so that you don't end up paying way too much for simple storage.
I'd go with Mercurial (hg) which is very easy to set up, you can host it yourself and is very easy to use. An alternative is Git, which is pretty much the same although the commands and internals are different.
Another alternative that's often used in commercial organizations is Perforce. I don't have experience with it myself, but I've heard good things about it and I think it should be able to handle huge amounts of files.
If you are new to source control, I recommend that you go with SVN. I find SVN to be most straight-forward option. VisualSVN is a good choice, works well and it is free of charge. However, I would encourage you to checkout hosted SVN repositories such as beasntalkapp.com.
What is your reasoning for adding all the images to version control? Will they change often?
In my experience, adding alot of binary files to any version control system is bulky, but particularly SVN, since you'll be checking for changes on the server, and a file check for 500.000 files is not fun.
I'd recommend you store your images in a shared folder instead, for example on a samba share or similar, and change the pointers in your code to that folder, so all developers share the same images.
The PHP code on the other hand should definitely go into version control, my recommendation is Git, but Mercurial is a good option. SVN is a legacy system that I wouldn't recommend.
Stay away from old versioning software especially Visual Source Safe!!! My advice would be to go with Git (and you have a free host at bitbucket.org as well as hosting mercurial but i've never used that one). github.com is only free for open source projects, bitbucket is also free for private repos but charges per extra user instead.
I've been using git now for about 4 months and it's brilliant. Sub version i found annoying and only used it briefly (was years ago and can't fully remember why i stopped using it - something to do with directory and file handling i think).
Git seems to be the latest one to get a good foothold and after using it it really is VERY flexible as well. I quite enjoy the rule that once you commit something to the repository - it's hard to accidentally remove it! Branching is also very fast compaired to alternatives and because it works by linking to the previous unchanged version instead of saving diffs and having to reapply them all it's quite small filesize wise and is VERY fast compaired to others. I also store about 3000 icons in it, 300 lines of code and about 500 php files + js libs, etc all in a single project and to be honest it's just as fast as when i first started with a few files!
You won't go wrong with Git - and use either github or bitbucket in the start as it's much easier to get started that way. You can always setup a repo yourself at a later date.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I've been developing web applications for 2 years now, and have been into simpler web pages for many more. I've been using Notepad, then ConText, then Crimson Editor (was my favorite for a long time) and I've been trying with Notepad++. I have NetDrive setup so I can edit and save files directly on the ftp server. On Firefox I use the Web Developer extension, Firebug and a couple more.
As my skills grow and need to do more stuff than before, I'm facing some limitations such as doing some versioning, tracking changes on the code, reverting back to an older version, these things I do them manually. Also I want to be portable so I'm trying to setup everything webdev-related in a Dropbox folder so I can sync it and have a functioning developer setup everywhere I go.
I'm wondering what software would you suggest for web app developing and how can it be setup to be portable or in the cloud?
I thinks it depends on whether you achieve a full-featured IDE or a collection of tools that do their job separately.
After using many editors on different platforms, I use Eclipse and Vi now: For small scripts that have to be changed quickly, Vi is the perfect editor, and it's available for every important platform, but it takes some time to lern the shortcuts.
But since most Web projects grow rapidly in size, I got need of a IDE which suits all my needs:
Subversion integrated
Code completion and helpful function for different languages (Python, PHP, HTML, even C++)
Availability on Mac, Windows and Linux
Open Source
Extensible via Plugins
Fully configurable
Eclipse does this all and much more. All the project stuff is placed in a workspace-directory, which you can sync via Dropbox or anything else if you want (since I would recommend storing project files in a repository rather than on a simple Webdav place).
Jetbrains' Web IDE is currently in beta and should be released before the end of the year. You can already download and use EAP releases. It will be commercial but might have a free/community version (as was recently announced for IntelliJ IDEA).
It's getting quite good with support for PHP, HTML, CSS and Javascript. It also has good version control integration (Git and Subversion are the two I've used) and has local change tracking (so you don't even need to check in to something to see old versions and revert them; it does this automatically).
That and a convenient distro like XAMPP is all you really need (well and Firebug).
I use Zend Studio (http://www.zend.com/en/products/studio/) as my IDE. It's not perfect (nor free), but I haven't found anything I like better and it has definitely sped up my development time. It really shines as a PHP editor, has a nice XML editor, decent HTML editor, and so-so JavaScript editor. But since it's built on the Eclipse platform, it should be possible to install plug-ins/mods. If you're like me and your main focus is PHP, with the other three languages taking a backseat, then I imagine this will suit you fine.
I wish I could tell you more about versioning, but I don't know much about this :/ I do know that Studio has a built in SVN manager. It also supports remote connections through FTP. I also use Dropbox, and there is no problem in using the two combined.
I've checked out NetBeans, and a few other IDEs, but there are so many small features/shortcuts that Studio has that the others don't that force me back to Studio. I will add these caveats though: Studio is memory hungry, and code hinting is much slower in the latest version than the previous (though they claim this will be resolved.) I suggest downloading the demo and seeing how you like it for yourself.
Try which editor you like the best. I used Aptana and different other editors (eg.: Zendstudio) a while ago, but I always go back to Geany (but I am on Linux) and a bunch of commandline tools.
You have to figure out yourself what is the best enviroment for you.
The editor part is totally up to you, I use both PHP Eclipse and Vim. I don't think versioning integration in IDE is that important but code completion and syntax error control sure do help.
Look into SVN and TortoiseSVN - it provides comfortable version control and you can use your sources from anywhere with an svn client and it's a must when you start working on one project with other people.
For the last year I've been contentedly developing using NetBeans 6.7 with [xdebug][2], Firebug 1.4 and [Darcs][3] as version control. The whole setup is portable, so I can use it on any windows machine and has proved very reliable; can't recommend it enough.
NetBeans covers all the bases: HTML, CSS, JavaScript and PHP with auto-complete and the xdebug integration, once you get it working, is excellent. Darcs is console only, but its so straightforward to use that you just don't miss the GUI. I use [Console2][4] to work with Darcs.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
For those of you who have had the opportunity of writing web applications in PHP and then as an application server (eg. Python-based solutions like CherryPy or Pylons), in what context are application servers a better alternative to PHP?
I tend to favor PHP simply because it's available on just about any web server (especially shared host), but I'm looking for other good reasons to make an informed choice. Thank you.
I have a feeling that some of the responses didn't address the initial question directly, so I decided to post my own. I understand that the question was about the difference between the mod_php deployment model and the application server deployment model.
In simple words, PHP executes a given script on every request, and the application has no knowledge of what has happened before (unless it is emulated somehow). Moreover even the source code is being parsed on every request (unless you use a bytecode cache like APC). This process can be slow, especially if you have a framework with complex initialization.
In contrast to this, the application server has to be started once, and then it waits for a request to be processed. The application server should clean up resources after every requests (allocated memory, open descriptors, etc.), it can also pool certain resources (like database connections) that can be reused between requests for extra performance.
This later model (application server) is more efficient in most cases, but on the other hand more difficult to setup and maintain. It is also more demanding, as you have to pay more attention to the resources you utilize, in order to avoid resource leaks.
The advantage of deployment for PHP is a huge one. You will also have a large developer base, and sound like you already have considerable expertise. In general if you know how to use a programming language well, you are safer to stick with it.
The advantages of using a Python web framework like Pylons are that your code will be neater, and more maintainable. Of course this is possible with PHP, but seems much harder to achieve. Python is simply a nicer language than PHP, so that might affect your decision.
Personally, I would not describe either Pylons or CherryPy as an "application server", if you want a Python application server, try Zope. (They both do serve WSGI Applications, but that is a topic for another question.) There seem to be plenty of equivalent frameworks for PHP, and they have been listed in other answers.
There are several products in PHP which fill the same space as CherryPy or Pylons.
(except, of course, they don't run Python ;)
Have a look at -
CakePHP - http://www.cakephp.org/
Symfony - http://www.symfony-project.org/
Code Igniter - http://codeigniter.com/
Zend Framework - http://framework.zend.com/
Personally, I prefer Drupal, which works as a great framework and comes with a lot of CMS and community site features out of the box. The ones above are quite different in many ways, but any of these should offer you the best of both worlds if you want an app framework / appserver that runs on PHP.
Drupal - http://drupal.org/
Which one is the right choice is largely a matter of taste, although each has its various advantages and disadvantages.
There are many more - these are just the ones I've heard good things about from colleagues and collaborators. It's not a complete list.
Python web-apps tend to require more initial setup and development than the equivalent PHP site (particularly so for small sites). There also tend to be more reusable pieces for PHP (ie Wordpress as a blog). Configuring a server to run Python web-apps can be a difficult process, and not always well documented. PHP tends to be very easy to get running with Apache.
Also, as PHP is very widely used and is heavily used by beginners, there tends to be very good documentation for it.
However, Python is much more fun, and much more maintainable. It scales well (in development complexity terms, rather than traffic).
Personally, I would also say that using Python tends to train you to solve problems in a better way. I am definitely a better developer for having learned the Pythonic way of doing things.
Using application servers like Pylons, Django, etc. require much more work to setup and deploy then PHP applications which are generally supported out of the box. I run a few Django apps and had to learn a bit of configuring apache with mod_python in order to get things to work. I put forth the effort because coding in python is much more enjoyable to me than PHP and after you get the Apache config right once you never really have to mess with it again.
On another note, if you decide to go with a framework like Django, Rails, Pylons, .... they tend to solve a lot of small repetitive tasks that you would otherwise do on your own. But frameworks are their own huge topic of discussion.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic configuration variables, installs or reloads the database, and generates a v-host for the site instance.
I have often thought that maybe we should be using Phing. I haven't used ant much, so I don't have a real sense of what Phing is supposed to do other than script the copying of files from one place to another much as our setup script does. What are some more advanced uses that you can give examples of to help me understand why we would or would not want to integrate Phing into our process?
From Federico Cargnelutti's blog post:
Features include file transformations (e.g. token
replacement, XSLT transformation,
Smarty template transformations), file
system operations, interactive build
support, SQL execution, CVS
operations, tools for creating PEAR
packages, and much more.
Of course you could write custom scripts for all of the above. However, using a specialized build tool like Phing gives you a number of benefits. You'll be using a proven framework so instead of having to worry about setting up "infrastructure" you can focus on the code you need to write. Using Phing will also make it easier for when new members join your team, they'll be able to understand what is going on if they've used Phing (or Ant, which is what Phing is based on) before.
The compelling answer for me is that phing understands PHP classpaths. Ant doesn't. I don't want to have an ant build.xml full of exec commands. I happen to be primarily a java programmer and still use phing. It's the best tool for the job.
I moved from Ant to Phing 'just because' it's PHP. I use it to export from different subversion repositories, copy stuff around, build different installation packages, etc all of that with a 20 line reusable xml file and a config file with project specific stuff. No way I could do it that fast with a custom script. I also plan to integrate api documentation generation and unit tests. Love it!
We use phing to deploy SemanticScuttle:
generate zip archive for distribution
create PEAR package
upload zip to SourceForge
update the PEAR channel with the new package file
render reStructuredText documentation into html files and uploading them. Currently with exec but I'm on the way writing a separate task for it.
Uploading the zip file and the channel is done via rsync, which is unfortunately not supported by phing through a special task - but using exec is always possible and works nicely.
In the end, it saves a lot of time and we're able to test, package and deploy our app with one single command (which gives us another point on the Joel Test). I would not want to live without it.
See the build.xml code.
I don't see any compelling reason to go with phing. I mean, should PHP programmers attempt a rewrite of Eclipse "just because" it might somehow be easier to write Eclipse plugins in PHP? I don't think so.
Ant has better documentation, including some nice o'reilly books, and it's well-established in the Java universe, so you avoid the problems of (1) "we haven't copied feature X to phing yet" and (2) the risk of the phing project going dead. Here's an article on configuring PHPUnit to work with ant and cruisecontrol: not that hard. And you get eclipse integration for free.
Good luck!