Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Why PHP continues to thrive in the age of the PaaS (plus.google.com)
74 points by mmahemoff on Dec 6, 2013 | hide | past | favorite | 100 comments


I don't do much web development, just a product once every year or so to play around with an idea. Always in PHP. A few months ago I was asked by a close friend to help them with a not-so-serious site. I decided that I'd use Rails, because, hey, I've heard nothing but good about it from HN and the like.

I was absolutely blown away by how much work it required to get started. That, and how painful it was to explain to a non technical person how to make visual changes.

I was told by a few friends I vented to that what I was doing was "too small" of a project, or "Rails is meant for web apps" which confused me because I assumed a site where you could upload images via a form and then browse and view them was right up its alley.

Edit: A lot of comments are talking about wrapping my head around the framework, MVC, ect. I had no problem building the initial application. My sore points are more about deployments and updating smaller things, like the image of a link. non-technical people don't often remember "oh, and if you want your change to show up, go to this folder, open 'restart.txt' and change it in some way. doesn't matter what, just add a space to the end".


You're making the mistake of conflating PHP the language with Rails the Framework.

I can do your app in Rails pretty damn quickly at this point (with one of my current skeleton frameworks I can add authentication administration and other nice features pretty much "for free" as well)

But tell me I have to do it CodeIgniter or Laravel and I'd be completely lost for days.


The question then is, can you throw together a website in Ruby? Plus, have your non-technical folks be able to edit the templates?


By the time your "non-technical folks" are editing templates, you have a problem regardless of your language/framework. If you only have enough knowledge to "add an image" stay out of my HTML!


my life got so much easier when i stopped pretending that non-programmers should be able to work on the templating layer.


Ruby is not a hypertext preprocessor. You don't have a simple web server and a templating language in-scope unless you find them and set them up.


Define "non-technical". Are we talking "I need teh WYSIWYGz" or "Cascading styles like a boss"?


> You're making the mistake of conflating PHP the language with Rails the Framework.

I've heard someone call PHP "the C web framework". I thought it was fitting, and in addition, it seemed that even as a C web framework, it was a failure.


PHP may have some rather serious flaws but it is far from a failure and runs on a huge majority of the web.


"but it is far from a failure"

CS-wise (and design-wise), it's very much a failure. It's a market success, though - just like VHS was, many years ago. ;-)


Agree that it has flaws, agree that it not a failure, but what do you mean "runs on a large majority of the web"?


PHP the C web framework? PHP a failure? Lol!


"Lol!"

I think you're in the wrong place. Reddit is this way.


True, it's not exactly fair to compare getting started with a language and getting started with a framework, especially one as opinionated as Rails.


If you were to start with a nearly blank slate in regards to your PHP knowledge + Laravel as a framework for example, throw in Composer, learning about Eloquent ORM and so on, you'd likely be facing the same reaction.

I'd like to also point out that if you want to do software dev by the book applying various sofware engineering principles and not just stringing something together that works, you're pretty much forced to use a framework. (either due to lack of time or lack of skills for building one the right way).

Sure, sometimes the most important thing is rolling something up quickly, but other times your project will be used by more than a handful of people, and/or you'll have expectations of producing monetizable value and anticipate regular maintenance/upgrades for which a different strategy is required.


Deploying small changes with Laravel is very, very easy, and that's the parent post main complaint about RoR.


3rd generation full stack web frameworks (django, rails, etc) are optimized for 6 month happiness, not 6 hour happiness

They take longer to get set up, but as your project grows the incremental work to "change one small thing" stays relatively constant, whereas coded from scratch php or lightweight frameworks tend to have complexity of a change that is exponential with the number of lines of code.

It's a question whether the investment is worth it for what you're trying to do. Sometimes, quite reasonably, the answer is no.

I've got my django routine to the point where it takes me about 30-45 minutes to spin up a new stack that I'd be happy to code on for years -- to me that's a relatively minor investment for huge rewards.


Yes, that's because PHP operates at thermodynamic equilibrium and creating order from those states requires the expenditure of energy.

Rails is great for creating a site with a form where people can upload images, it's a 20 to 30 minute project in rails, pretty much just take any rails blog tutorial and add paperclip. (Note, it's not a 20 minute project for anyone who doesn't already know rails)

Rails is not for non-technical people. Rails is like a great jig, if you're a master craftsman it's going to save you a lot of time, if you're not don't bother, just tweak things until they fit together. If you're someone who has spent the last 5 years building furniture by tweaking things then you will love a jig.


http://en.wikipedia.org/wiki/Automated_external_defibrillato... -- the AED is worse in every way than a properly trained professional with the right tools, except for one way: its there, it sort-of works, and you can't beat something with nothing.

Requiring a professional is a flaw, not a virtue. It's particularly problematic in our industry, where the end-user and most of the people involved in the production are not professional programmers.


> Requiring a professional is a flaw, not a virtue.

Your statement depends entirely on the context. I agree that requiring a professional to assemble my IKEA furniture would be a flaw. Requiring a professional to assemble my custom marble kitchen countertop totally makes sense and I'd hardly slam IKEA for not having such a package in Aisle 12.


Wow this is a really intriguing philosophical difference. I'm a big fan of specialization. I think it is the only way a complex society could possibly function. I'm glad that as an end-user of cars, airplanes, trains, medicine, MRIs, television, movies, wine, beer, liquor, the legal system, government services, etc. etc. etc. I don't need to be an expert in their design, development, and maintenance. It's great that because of its nature, software is more accessible than most things, but that doesn't mean it should all be made by non-professionals. There's plenty of room for both non-professional and professional tools, and neither approach is fundamentally flawed.


There's nothing wrong with professionals building tools for other professionals. PHP surely requires less activation energy for a tiny project or a new developer, but that doesn't mean Rails et al aren't providing useful options for full-timers.


I spent most of my life in PHP, and now spend most of it in Ruby/Rails and mobile development. Believe me, people can make utter messes no matter the language. This is not as strong as an argument as you think it is. I've seen my fair share of terribly coded Rails apps as well as PHP ones.


Yup, often PHP is the right tool for the job, however, in professional settings it is invariably the wrong tool for the job.

Just as you'd never want to use an AED at a hospital (unless every medical professional was unavailable)


> Requiring a professional is a flaw, not a virtue.

Don't you think that depends mostly on whether there are professionals available?


No. If a professional is available, better paths will be taken. If not, there is no requirement.


Funny, but not necessarily true. With PHP, I do as you say and spend, if I know the language, 1 hour max setting up a CRUD list/view/admin.

With Ruby, I have to spend, at least 3 months learning the concepts behind the Rails framework and what the article OP mentions just to get to that 20 to 30 minute mark.

If anything it's all meaningless, and what everyone should understand is that while the closer you are to the web server itself (CGI+PHP, Node.js, Classic ASP), you can quickly create any type of code, at the loss of organization and order.

In frameworks (criticism of Rails can also be attributed to Wordpress IMO) you have a much larger ramp up time learning the concepts and conventions, and once familiar, are able to LEVERAGE those patterns.

But don't bother me with PHP vs Ruby. I run SSI on nginx. It's not even in the same league as those two. BUT it's even easier to spin a basic 5 page website. All tools have their specialties.


I think your first two lines are a bit unfair. In the first line you say it takes you an hour while mentioning in passing already knowing the language.

In the second you say it takes 3 months because you have to learn the framework. Honestly if it takes you 3 months to understand rails well enough to do a CRUD app there is no way you're learning PHP well enough to do the same CRUD app in less time.


The problem is learning PHP actually makes you worse at PHP.

The only possible way to program PHP is to be pretty much ignorant of everything in which case PHP will actually do kinda what you wanted. If you learned PHP then either it's not actually doing what you think it's doing, or some config variable changed and would have done what you thought except it didn't, but don't worry just add some code to change that config variable for a while, and then change it back.

PHP is zen.

There is a story of a young, but earnest PHP student who approached his teacher, and asked the Master, "If I work very hard and diligently, how long will it take for me to learn PHP?"

The Master thought about this, then replied, "Ten years."

The student then said, "But what if I work very, very hard and really apply myself to learn fast. How long then?"

Replied the Master, "Well, twenty years."

"But, if I really, really work at it, how long then?" asked the student.

"Thirty years," replied the Master.

"But, I do not understand," said the disappointed student, "at each time that I say I will work harder, you say it will take me longer. Why do you say that?"

Replied the Master, "When you have one eye on the goal, you only have one eye on the path."


I think the big problem with PHP is the fact that you can find so many tutorials online still not having caught up with current practices, not just in terms of language updates or security, but in terms of software engineering. Not knowing any better and how to distinguish between quality learning material, newcomers will happily put into practice what they've learned on good 'authority' to be correct. Same applies for many books on PHP. There's one particular very prolific and popular author, whose PHP books are always revelled, yet if you read them, he's not actually teaching at a standard a lot higher than what you can find other places. You end up having to spend more time having to re-learn stuff and trying to forget bad approaches...one of the downsides of it being a language with a longer history that Ruby+Rails.


Hi, this is very interesting to me as I am currently picking up PHP.

Can you point me to some resources which don't fall into the trap you highlighted?


Thank you dearly for this. What's your opinion on SSI?


I'm not personally a huge fan of SSI, however, it's simple and understandable, and things do what you think they do.

What I like about it is clean separation, a few command for common things, and if SSI doesn't directly support what you want you just hand it off to another program.


With Laravel: php artisan generate:scaffold some_type --fields="..."

That's not one hour. That's one minute.


Ruby is my favorite language but I had kept out of Rails for years besides hello-world stuff. The amount of layers upon layers upon layers makes one's head spin. And if something goes wrong, you better hope you are using the exact same toolchain as the audience on StackOverflow is using, because that's what they'll be expecting you to have as well.


I was in the same boat, I had spent years creating PHP websites and then was faced with the Rails framework. When you're first getting used to MVC, it seems very counter intuitive. I ended up using Symfony to get used to MVC while sticking with PHP, and now have switched to Rails and wouldn't dream of going back.

When you're first starting with it, especially moving from creating PHP files, it seems very counter intuitive and over complicated. But once you get used to the layout, you understand why it really is far superior for creating websites.


I know the author emphasizing a point, but the steps that he's described end with two vastly different results:

1 - A php script on a server with a script with some code on it.

vs

2 - A full featured MVC framework, complete with version control, database integration, easy deployment, which is easy for other developer to jump into, etc etc

How can these two options be equated?


A lot (a majority?) of websites aren't made by people that need those things. A lot of people just want to get their ideas up on a page so they can show their friends. The thing I walked away with from the article was that PHP is still active in part because it has such a low entry point for those people, where as Rails does not.

Like you said, they're very different entities, but a lot of people can't tell or don't care about the difference.


i'm personally learning to love static html again. the longer i can get away without a users database the better.


I don't know about you, but when I decide to do a project, I'll often use a new technology that I'll struggle with, because I want to learn and grow as a developer. Giving up because something is hard is a poor excuse. Period.


Who said anything about giving up?


You're right, you didn't. But, would you use rails again for your next project? The tone of your comment sounds like you'd like nothing to do with it next time around.

I didn't mean for my comment to come off as snobby, I just hope you don't discard rails/ruby (or branching out from php) because you feel it's not the easiest to work with out of the box (even if only for non-technical people).


No, I'm not out right discrediting it, but given how little I do in web and how small most of my experiments are, I probably won't use it for a long time just because I don't need what it provides.


It's funny too that upload functionality is mentioned here in your base requirements, because that alone is a whole bunch more steps when deploying to a PaaS like Heroku. You don't have a local filesystem, so you have to find and use gems like carrierwave, signup for Amazon S3, create a bucket, configure it in your Rails app, etc. etc.


> ...I assumed a site where you could upload images via a form and then browse and view them was right up its alley

Ah, your assumption was correct but incomplete. Doing that and a bunch more is right up its alley, but if you're doing only that, there are much easier ways.


shameless plug but next time you want to do a web-app/site consider our product (crudzilla.com)...it is basically a web-dev-to-deployment solution in one package.


down voted?...internet forums just get new names but the character remains the same:)


Laravel seems a much better investment for you.


> Why PHP continues to thrive in the age of the PaaS

Most companies/clients, particularly outside of the SV/SF bubble, value a working solution over technical elegance. They're not irrationally ideological about programming languages, and they don't want to pay $120,000/year or $125/hour to a developer with two years of experience.

Given the supply of developers of various skill levels who can build working solutions using PHP, and the number of existing commercial and open-source applications based on PHP, it's no surprise that PHP is thriving.

> But the question is, why should PHP still be easier to deploy than Ruby/Rails, Python/Django, Node/Express (or Metro)?

It's interesting that the author grouped Ruby, Python and Node with frameworks for his comparison to PHP sans framework.

Incidentally, I think one of the advantages of PHP is that a lot of PHP developers, especially those who have been working with PHP for some time, didn't get started with a framework. Heck, before there were mature frameworks, many PHP developers rolled their own frameworks and micro-frameworks, a valuable exercise.

Third party frameworks are great, but they can easily become a crutch, and when you don't know anything but the framework, they can be downright dangerous.

What percentage of Ruby on Rails developers who started their careers with Ruby on Rails are capable of building a moderately complex Ruby application without Rails?


I agree that there is an absurd, nearly worshipful view of certain technologies in the "SV/SF bubble." That, however, is irrelevant. Your final comment regarding frameworks is also something I'd tend to agree with; frameworks are great for solving problems within the domain they're built for, but their applicability outside those domains is limited.

This, however, is going to be an unpopular opinion amongst the PHP crowd, but I can distill the rest of your comment into the following statement: "PHP is thriving because companies are cheap, don't care about quality as much as cost, and there is an over-abundant labor supply of poorly skilled, mainly self-taught PHP 'developers' who are willing to work for peanuts and get the job done to an adequate level." There's nothing inherently wrong with that, but trying to turn it on its head by implying developers skilled with, e.g. Ruby/Rails frameworks (see note below), are essentially overpaid and narrow-minded is just absurd.

Note: I especially am not a fan of Ruby, so don't take this as a defense of the language or its developer-adherents. I'm actually fairly language agnostic; "right tool for the right job" and all that.


> This, however, is going to be an unpopular opinion amongst the PHP crowd, but I can distill the rest of your comment into the following statement: "PHP is thriving because companies are cheap, don't care about quality as much as cost, and there is an over-abundant labor supply of poorly skilled, mainly self-taught PHP 'developers' who are willing to work for peanuts and get the job done to an adequate level." There's nothing inherently wrong with that, but trying to turn it on its head by implying developers skilled with, e.g. Ruby/Rails frameworks (see note below), are essentially overpaid and narrow-minded is just absurd.

That's an interesting reading of my comment. A less cynical reading might be that companies tend to:

1. Value cost-efficiency.

2. Understand that the constraints of time, cost and quality are all related and must be balanced based on business and project need.

3. Recognize that a smaller labor pool tends to increase cost and risk, sometimes unacceptably.

Most companies simply don't have the luxury of, without regard to cost and schedule, writing blank checks for development, demanding perfection (elegant code, the technologies du jour, premature optimization, etc.) and limiting their employee/contractor pool to rockstar engineers with CS degrees from top universities.


> They're not irrationally ideological about programming languages, and they don't want to pay $120,000/year or $125/hour to a developer with two years of experience.

I worked for a typical megacorporation for a few months (in Maryland). This is consistent with what I've observed. the company's main goal is to do what's required as cheaply as possible.

That said, Rails is starting to become more popular among the enterprise crowd. The main reason for it is that developers are more productive with Rails (given that they are working on a nontrivial project and have prior experience).

> What percentage of Ruby on Rails developers who started their careers with Ruby on Rails are capable of building a moderately complex Ruby application without Rails?

I think the main problem is that a lot of people try to learn Rails before learning Ruby. We end up having a lot of people who are experienced with a particular framework (Rails, jQuery, whatever)... but they know basically nothing outside that framework.


"It's interesting that the author grouped Ruby, Python and Node with frameworks for his comparison to PHP sans framework."

Mainly because people rarely talk about pure Ruby/Python/Node CGI development. They're almost always run through an app server.

I realise there are indeed some excellent PHP frameworks nowadays, but to my knowledge, most can still be run in a basic CGI environment. And more to the point, probably the majority of quick hacks in PHP are still done without any framework.

[BTW I meant Meteor, not Metro.]


PHP continues to thrive because of WordPress and PHPBB. There are so many sites running these two pieces of software that PHP will be a top language for years.

PHP is also one of the easiest languages for Designers to learn. If you know HTML, adding a few bits of PHP is easy.

Even if you dislike PHP, (I certainly do) you end up getting good at it because enough projects touch it that you kind of have to be good at it. It is like JavaScript, I don't like JavaScript as a language, but it is essential because you can't not know it.


And Drupal, Joomla, Magento, SugarCRM, CiviCRM, WebERP .....


Drupal, Joomla and Magento are horrible, and the others are certainly not widespread enough to keep PHP alive by themselves


I think you're right mostly because of WordPress.

In 10+ years of professional web development, I've had, I think, 1 client ever who had PHPBB on their site, but I work on at least 1-5 sites a month that are running a variation of WordPress (or just PHP in general). And every new site we setup is running WordPress on the back-end now.

I've also never had a client come to me who was running a Ruby, Python, etc, system. The strangest it has gotten was a Cold Fusion site here and there, and maybe once a year a .Net / ASP site crawls through the door..... and we have pretty religiously completely converted the sites to PHP in these cases before we start to manage them.


You're right, and it's kind of ironic that Node doesn't get to be the server-side language of choice for designers already dabbling in JavaScript. But in the absence of a one-click deployment for Node, we have HTML > CSS > client-side JS > PHP as the standard technology path for a designer who wants to Get Stuff Done.


Because the vast majority of PHP programmers began their programming journey by trying to post from a form built with static html, and worked their way down. In my experience (YMMV), they tend to lack the general programming concepts and practices that programmers who come from a CS/general computing (instead of web design) background are more likely to have, making it more difficult for the PHP programmer to move into another language.

I think the pervasiveness of modern, complex js techniques in recent years have been eroding that situation, because (especially with the gentle on-ramp of jQuery), PHP programmers are forced to become good js programmers too. Right now that means that a lot of the parochial attitudes of PHP programmers end up in the js community - and you see that in node.js, but ultimately it means that those programmers become familiar with two extremely different programming paradigms, and that will make a third language a lot easier to learn. When not trapped, they will leave.

I never understand the argument that PHP is an easy language (which this post doesn't suggest), though. PHP is hard because it is awful, and it's awful because it's hard. Consistency and lack of hidden state make things easier, at least for me. PHP is an easy language to put into production. Ruby is an awful language to put into production. I'm not even sure why the two get compared other than that Rails is supposed to be "easy" and PHP is supposed to be "easy."

A better feature to use to compare Ruby and PHP is that both of them fall to shit pretty immediately at load unless you are so good at enough layers of the entire stack that you're running on that any ease of learning or using PHP and Rails will make a minimal difference to you.


I have a bone to pick with your last contention. At what load does the PHP runtime begin to become the performance bottleneck, particularly with APC enabled? As far as I know, Facebook is about the only application with enough load to test the limits of the PHP interpreter itself. I was under the impression that PHP itself is actually quite performant...


see: drupal.

having to execute the whole application from the entry point on every page hit is just awful. APC will only save you the loading from the disk and compiling part, not the whole execution chain.

with node and others the application is just sitting there, listening to a port, and fires the right callbacks when a request comes in. the application startup cost is paid once. not on every request.

there are people who have tried to reproduce it in php by having php running and serving multiple requests in a similar manner. This is really treacherous since php didn't even pretend to free memory under any circumstances ever, until about php 5.3.

since moving over to writing servers, i just feel that the php model of executing the script when a url is hit is just fundamentally wrong.


Drupal lives in its own separate category somewhere near Mars. Just because Drupal is slow does not mean that PHP itself is the reason why.

> APC will only save you the loading from the disk and compiling part

Is that not the slowest part?

According to the benchmarks here, http://www.techempower.com/benchmarks/#section=data-r7&hw=i7..., PHP is only really slower than Node in serving up a plaintext response and a json serialization (although, it is only about a 5% difference in responses/sec between the two).


Facebook runs compiled/JITted PHP code.


Right, but they are only doing that because they serve so much traffic. The original post suggested performance "falls to shit pretty immediately at load." I cannot imagine they meant that you need to do some serious gymnastics to get around performance bottlenecks when you get to Facebook's scale. My supposition is that most web scripting languages would need tuning at that level.


From knowing nothing to building a simple web app, PHP is faster.

If you already know RoR and have your dev machine and deployment environment all set up, then it's not hard to get a Rails app working. Rails has a significant advantage with the use of gems (and bundler, etc.) for easily adding complex features.

I still use PHP for my home projects most of the time because I haven't bothered to set up Rails on my VPS, so the effort it would take to do so just isn't worth it compared to how easily I can drop a PHP app in place. (I am using a framework in PHP too.)

But then, the author was talking about PaaS not setting up Ruby on a VPS. So in that case it's probably just about how comfortable the developer is with each language. I'm a bit more comfortable with PHP because I don't like debugging Ruby GEMs that use instance_eval black magic for DSLs and/or have to be inserted as Rack middleware. Not unless the project is large enough to make Ruby gems worth it.

(Eg. if I want good unit and integration testing. For home projects I rarely do integration testing. E.g. #2 was rack middle ware for REST API.)


I'd say you can get from zero to working app faster in Rails. You can get away with knowing no SQL, and not really grasping concepts like GET v. POST. A few scaffolds, Omniauth, and one of the Bootstrap gems, and you've got a decent app worthy of Show HN karma.

In PHP, you need to learn some HTML, some SQL, and general web concepts that Rails hides.

No, learning isn't bad. No, I don't think scaffolding is acceptable. I've used PHP since v3, and Rails for a couple of years, and many other languages since 1999, and I'm just trying to get into the beginner's head.


OP nailed it.

PHP has similarities to Bash scripting. Language sucks. Syntax is awful. You wouldn't want to build anything big with it. You feel dirty and ashamed every time you use it.

But... if you just want to get shit done, it's often the path of least resistance. I can live with the shame.

By the way, Mike isn't just talking about PHP here. It also applies to CGI, ColdFusion, ASP, JSP and lots of other old technologies that make you want to cry. Basically anything where you have a web server and you can just drop executable scripts in a directory.

Even though I rarely use PHP any more, I still write a lot of my Python and Ruby web-apps using classic CGI instead of the popular frameworks because it's just so quick and easy (and dirty). Deployment is a breeze, managing servers is simple and it's ideal for quick mashups. Been meaning to write more about this: http://helpmewrite.co/people/joewalnes/ideas#idea-1978


PHP has also become a much more vibrant language to develop in. It doesn't have the coolness factor of Haskell, Go, or Scala, but it has become a lot better in the recent years.

Combined with a better overall language (that still has it's warts, lets be clear here) and an ever expanding amazing ecosystem of great libraries and you have something that is easy to deploy _and_ fun to work with.


Stuff like composer, Silex/Symfony2, the addition of closures, the speed of new versions + OpCode caching make PHP pretty usable.

Thinking LAMP as a whole - the speed of new versions of MySQL (5.6, 5.7) and the Percona branch are also pretty sweet.


How much has Facebook's open-source contributions to PHP (say, the HHVM) helped the development and adoption of the language?


Not sure how many every day PHP deployments are using HipHop. Probably nice option to have when you get to a certain point.

But Memcached, APC, and wrappers for Redis probably have done the language much more of a service in ways...


tl;dr; PHP is not that shitty nowadays thanks to the community, just Web Dev is too fad driven those days. I am writing something a bit against the current fad therefore I expect to find this post at the bottom when come back after dinner.

When it comes to PHP, I always remember that when it comes to the tools, you can do almost anything with almost any other tool. And the flamewars are just waste of time.

Many people say PHP is not elegant. Yeah, it's far from perfect. But have you written any PHP app recently? The answer is almost always no. The fact is that normally, you heavily use a framework and your interaction with 'naked' language is minimal. I mean, the shitty naming conventions (or lack of) and etc has minimal effect.

Just here comes another problem, there are just a LOT of half-assed frameworks. And for some reason many devs like to roll out their own one. Usually not the good devs.

But on the other hand, some frameworks are around for many years (well, in Web 5+ is many) so probably 99% of the issues you will have were faced by someone else already, and the solution will be in the first google result.

In conclusion, no it's not perfect in some ways (nothing is perfect, anyway), but it lets you get the shit done very easily.

I am just not one of the people who get religious about the languages. You use PHP? Cool. You prefer Ruby? No worries, that's fine for me!


He kind of lost me on his opening CGI argument. Most PaaS I am familiar with don't run PHP through CGI at all. Either Apache mod_php or nginx php-fpm. I guess the author means a CGI-like model or something?


OP here. That's what I meant. We often compare PHP to e.g. Ruby/Rails, Python/Django...but what we're really thinking of when we think of PHP is CGI.

Most of the same things we say about PHP deployment (it's easy, can be done in one file, etc) could equally be applied to writing CGI scripts in Ruby or Python. PHP is just a more extreme example of CGI, and arguably easier, because there's so much support for PHP-based CGI compared to Python/Ruby/Node CGI.


I'm afraid you're misinformed. When we think of PHP, most of us are thinking of PHP embedded in the Apache web server using the mod_php extension. This is what almost everybody was using until very recently when FastCGI gained some popularity and people started using PHP-FPM with nginx. Pretty much any PHP host will be running a LAMP stack with mod_php.


OK most hosts will be running mod_php or fcgi and not pure CGI. I just mean CGI as a shorthand for this approach. It doesn't make a difference from the developer's perspective on a shared host. It's still just "here's a file I created, now point your browser at it".


FPM is a CGI like model. The F stands for FastCGI. Also many cheap-ass virtual servers do run php-cgi.


Most dirt cheap hosts do. PHP via a PaaS is just as hard as Ruby is his argument.


So CGI means you hack directly in production? You don't need to set up a database? Don't have to test it? Don't version control your code?


PHP is popular because of it's simplicity, low cost (like zero) of entry and because of Wordpress.

But the pay rate for PHP developers is miniscule because every Pakistani and Indian is a PHP expert for $1/hr. Try to post a $20 professional website job on Elancer - and in 10 minutes you'll get 20 lancers eating each other for your "business".

So "thriving" is to be taken with a grain of salt.


I don't think that's a fair evaluation of any language. I also don't see how Ruby or Node or Python don't have a zero cost of entry.


Well you want to avoid those freelance sites anyway regardless if you're doing projects using php or not. Making a good living building stuff is not even about what language you use, it's all about networking and how good you're talking with clients.


You're forgetting Drupal.


"And yes you get the benefit of version control and not editing the live version, but my point is most projects don't even need that."

Lolz.


One of the main reasons it continues to thrive is that any person with an idea looking to "make a website" will almost always first find PHP when searching. That's how I started with PHP. I had something I wanted to build, looked up how to make websites, and found PHP.


PHP also has a lot of very cheap hosting options, I have seen them advertised for as little as $3 per month. Trying to host rails for less than $10-15 is challenging.

There's also a ton of complete software solutions available, like phpBB, vBulletin , Wordpress etc. The PHP industry offers more scripts for a one off $x download which can then be deployed via FTP by a non-technical person who doesn't know git.

The rails/django ways seems to be to sell everything as SaaS. The upshot of this is that a non technical person can get something started with a PHP based system, so by the time they call a serious developer in to help there is already inertia.


If you include cheap-o VPS like DigitalOcean into the Rails hosting, then yes you can get it for $5. But then the money you're saving will go into setting up the instance.


Is it faster to write a report in notepad or Word? Depends on your level of expertise. If you have none, then notepad is the faster. However if your job requires writing reports all day then learning to use Word is better in the long run.

For a simple pages with no prior coding experience, PHP is the best tool for the job. However if you plan on building complicated web apps as a profession, then perhaps learning a better tool is worth it.

For example, you can replace Visual Studio with PHP in this image:

http://i.imgur.com/ghAccKb.jpg


The workflow he lists for CGI/PHP is one where people work right off of the live server. This is no way to work when working on complex software. Typical PHP oriented hosting services are basically PaaS with MySQL and PHP good to go.

Deployment, Staging, Package Management, etc are worth their weight in steps over the long run.

Like a few people have mentioned, Boiler-Plate/Template projects are how many of us work around quickly bootstrapping a new project.


my thoughts too... working on the live server... Never do that!


For me no other framework or language can be compared the speed of deployment on php. If an idea I've got is simple and don't want to take weeks deving, LAMP is there to the rescue. For example I built (http://vinetuber.com) in 3 hrs. But for bigger projects, I django.


I think it boils down a little that for PHP you get php-fpm with the distro package and with Flask/Sinatra for example you have to

  * decide which *(c|s)gi package you want to use
    (thin, webrick, gunicorn, unicorn, puma, tornado, 100 more)
  * write your own supervisord/circus/god/whatever 
    wrapper to make it restart automatically
  * fight rvm/virtualenv/chruby/whatever
Notice a pattern? I can deploy a sensible, non-minimal php web app with "apt-get install nginx php5-fpm && scp" whereas I need already a decent amount of decisions for the other 2.

With PHP deployment only gets complicated at a larger scale. With Python and Ruby web apps it's complicated from the start.


PHP thrives because it is easy to deploy: upload your files and click refresh. When working with less technical people (designers who only know HTML, etc.) this is a great feature.


Your comparison is invalid and irrelevant. You're comparing writing a simple PHP script on a remote server to deploying a full Rails app. Please do the same comparison with Rails vs Symfony/ZF and then we'll talk about it.

When I used to be a Ruby developer, every time I heard that "PHP is easy to deploy", I made a less-than-one-minute demo showing how to create a Sinatra app from scratch and deploy it on Heroku is just few commands (any Sinatra dev here can do it).


"You're comparing writing a simple PHP script on a remote server to deploying a full Rails app" <-- the point is, Can you do that in rails?


I'm sold on php because of symfony, composer, and really good documentation of the language as well as the third party libraries. Been using NodeJS for quite some time, although I like it, I still have trouble looking for good documentation very no and then.


Ssh into your favorite cheap-ass virtual host

This assumes you've setup your keys properly, and have a grasp of this already. If you're assuming prior knowledge and configuration, would the same be true of setting up your Heroku toolchain?


You don't need keys to ssh.


Cheap-ass hosts won't need keys. They'll give you a hostname, username, and randomly generated password.

Insert into Filezilla, and mission complete.


I think this is a fallacy. Easy deployment has nothing to do with why PHP is still this popular; I think it has a lot more to do with PHP being beginner-friendly, in that when things break, they always semi-work as opposed to leaving the wannabe developer completely lost.

For the sake of comparing, here's how I make a throwaway app super quickly in Ruby, almost equivalently to a PHP deploy:

    $ ssh server
    $ kenji init project # [1]
    $ cd project
    $ tmux # launch a background session, edit some code
    $ bundle exec rackup # in a pane next to my code
Boom, brand new web-app is running on my server in less than a minute's work.

[1]: This is a Ruby web-app microframework. https://github.com/kballenegger/kenji




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

Search: