Hacker News new | past | comments | ask | show | jobs | submit login

The TRUE problem with PHP is that you can prototype extremely fast in it, and then you are stuck in PHP. Django and the like have a lot of setup time to really get started, even if after a few hours into it you're already saving time compared to PHP.

I've found it hard to argue against PHP with my former bosses, due to this fact.




Alas, the rapid prototyping is a trap I fall into all the time. Spinning up an ol' Symfony 1.4 application to mock-up a REST API so I have something to build a Backbone.js app against is the practice that keeps leaving me tethered to PHP.

If there were something that would allow me to spin up local application and work with my existing, already running Apache processes, I could move away from PHP.


Sinatra is pretty great for rapid prototyping. For example: https://gist.github.com/3062572

Then I just invoke it with "shotgun rest.rb" and hit http://localhost:9393/ and I'm up and running. It's not running through Apache, but it's not really significantly more difficult than PHP prototyping.

    curl -d "foo[bar]=1&foo[baz]=hello%20there" http://localhost:9393/foos
    {"result":"success"}

    curl http://localhost:9393/foos/1
    {"bar":"1","baz":"hello there","id":"1"}
Easy peasy.


Agreed, actually. I learned I can stand up Sintra and not bork my local apache instance, and now I'm hooked. Thanks!


Flask works very similarly in python-land. When I want to whip up an API I fire up Flask + curl.


I have the same thing set up with a couple of lines in the terminal with rails though, it's just a matter of having some experience with the tools.


I can set up a new Django environment in virtualenv, using Pip in about 15 minutes (using sqlite) without using a 'skeleton' template. Having not touched PHP in years, it would almost certainly take me longer to get PHP up and running with Nginx/Apache.

With Django 1.4's templates, you get more speed boost on setting up each app. With 'manage.py runserver', you don't even have to mess with Apache/Nginx to get running.

Regardless, comparing "PHP" to Django isn't particularly fair, even though I would argue that it isn't as one-sided as you make out. You can get started in Flask in slightly more than the time it takes to type 'pip install flask'.

If you're baselining PHP to Python, then know that Python has a much greater penetration on Unix servers, though arguably 'web hosting providers' are also very likely to have PHP installed (if it isn't dedicated).

Since you brought up Django, how long does it take to get started with CodeIgniter or Symfony (a better comparison to Django)?


If you're a real newbie, terms like "virtualenv" and "Pip" are much harder to wrap your brain around than "unzip this ZIP file into your web root", which is the way you set up, say, CodeIgniter.


If you're a real newbie, then perhaps PHP is the better choice -- not because of complexity, but because of the lack of proper rigidity enforced in getting started.

Though I will say that I read 'getting started' as the cost of getting started on a new project, not 'your very first' project. In that regard, sure, PHP is easier. It gets that way by encouraging programming idioms that most other languages actively discourage.

I understand the argument for would-be developers to get started with PHP. That's not too far off from how I got my introduction into web programming, but I have a hard time believing that developing developers choose PHP over Python or Ruby because it's easier to install.


I actually am a full-time Django developer (pip and virtualenv included), and I hate PHP.

But if, say, I want to try out a new JS library or widget, I'm pretty likely to just throw a PHP script in my webroot and use that, instead of firing up a full-blown Django project.

The time from deciding to write some HTML or JavaScript or whatever to actually writing it in a PHP script? Basically nothing.


What does PHP have to do with JS?

I'm not trying to be snarky, but I feel like I'm missing something. How would creating an 'index.php' be any faster than an 'index.py' with Flask or just using Python directly?

Again, comparing it to Django isn't exactly fair. I wouldn't see many people standing up a full CodeIgniter setup for that either.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: