News for hackers. Stuff that matters.
Re:The new PHP by d23 on Tuesday March 04, 2014 @08:39AM (#7340046)
> It contains powerful new features and helpful developer tools, such as a built-in web server

I haven't finished the article yet, but really? Is that what PHP needs? A built-in web server? It strikes me that adding more tools that incompetent web developers can abuse is what got them there in the first place.

How long until we start having security releases for the PHP web server, because so many clueless devs decided to launch and run their site with it?

Re:The new PHP by maratd on Tuesday March 04, 2014 @08:44AM (#7340077)
The web server is explicitly for development purposes. It is not meant for production.

> It strikes me that adding more tools that incompetent web developers can abuse is what got them there in the first place.

This is profoundly ridiculous. It's the equivalent of saying Home Depot shouldn't sell power tools because some do-it-yourselfer might saw his foot off.

Just because a tool can be misused is not an argument against it nor its inclusion.

Re:The new PHP by acdha on Tuesday March 04, 2014 @09:35AM (#7340364)
> This is profoundly ridiculous. It's the equivalent of saying Home Depot shouldn't sell power tools because some do-it-yourselfer might saw his foot off.

You're incorrectly characterizing the argument: it's actually like saying Home Depot shouldn't sell power tools without safety guards, fuses, emergency shutoffs, SawStop, etc. PHP has a number of misfeatures which make it extremely easy for all but the most vigilant of developers to make mistakes with security consequences (https://eval.in/108854 was making the rounds just this morning) or simply increasing the likelihood of creating bugs (i.e. the inconsistent parameter ordering across the similar array_* functions). Most of these complaints date back to the late 90s but now are much harder to make both because the core developers don't take them seriously and because there's now a huge backwards compatibility problem.

The most interesting development in PHP is the HHVM hack mode or similar concepts where an actively-maintained codebase can opt-in to safer behaviour. For the sake of anyone who has to secure code on the internet, I hope this catches on.

EDIT: See slide 15 onward in http://www.slideshare.net/skamerman/ipc-2013-high-performanc...

Re:The new PHP by fleitz on Tuesday March 04, 2014 @02:03PM (#7342306)
Here's all you really need to know with PHP, ask a PHP developer how to test for equality.

Maybe how you test for equality shouldn't depend on an ini file... just sayin...

Perhaps testing for equality doesn't need a 3 page answer... in most languages it's a pretty straightforward answer... primitive types use == and objects use either isEquals or operator overloading.

Re:The new PHP by codygman on Tuesday March 04, 2014 @04:35PM (#7343351)
I'm as critical of PHP as anyone, but I couldn't find any settings to change how equality works in the language here:

http://www.php.net/manual/en/ini.list.php

Re:The new PHP by xd on Tuesday March 04, 2014 @02:23PM (#7342425)
What do you mean by depend on an ini file? I wasn't aware there was any settings for equality testing there..
Re:The new PHP by mehwoot on Tuesday March 04, 2014 @08:54AM (#7340123)
Just because a tool can be misused is not an argument against it nor its inclusion.

I used to believe this, but now I couldn't disagree more. People can and do misuse things all the bloody time, and the more you enable them to do that, the worse your tool is. How people use what you make is every bit as important, possibly even more important than the technical merits of what you make.

I'd rather a builder use a second hand hammer to nail something than try doing it with a jackhammer.

Re:The new PHP by Karunamon on Tuesday March 04, 2014 @09:01AM (#7340166)
>People can and do misuse things all the bloody time, and the more you enable them to do that

This is an excuse for educating people, not an excuse for kneecapping the majority due to an ignorant minority. This is the kind of thinking that plagues the GNOME3 devs and gets ridiculed so often around here. The user is an idiot so let's remove features.

I don't see many people harshing on Rails for the inclusion of WEBrick.

Re:The new PHP by Freaky on Tuesday March 04, 2014 @02:53PM (#7342604)
Ruby, you mean - it's part of the standard library.
Re:The new PHP by TeMPOraL on Tuesday March 04, 2014 @09:09AM (#7340211)
> People can and do misuse things all the bloody time and the more you enable them to do that, the worse your tool is.

In terms of avoiding accidents I agree, but in general, I don't like this kind of thinking.

One man's misuse is another man's hack. The flipside here is that the more you limit and subdivide a tool, the worse your tool becomes.

I'd also rather see builder using something else than a jackhammer to nail stuff, but then I also want him to have access to one if he needs it, and I strongly want people to stop shouting "omg you can't use X to do Y, because X was not meant to do Y". First principle of hacking: tools do not have inherent purpose, they can be used to do whatever we want; they only can be better or worse at a particular task. The world didn't collapse into logical contradiction the last time I cut pizza with a sound card, because of lack of any other sharp tool nearby.

Re:The new PHP by einhverfr on Tuesday March 04, 2014 @10:01AM (#7340540)
> People can and do misuse things all the bloody time, and the more you enable them to do that, the worse your tool is.

By that measure, PostgreSQL is a horrible database. After all look what happens when I do this:

    CREATE TABLE foo (
       id serial not null unique,
       bar text primary key
    );

    CREATE TABLE foobar (
       chunk_id serial not null unique,
       foos foo[]
    );

    INSERT INTO foobar (foos) values (array[row(1, null)::foo, row(2, '1323')::foo, row(3, '2222')::foo]);

    select * from foobar;
I mean my gods. Such horrible misuse of a relational db!
Re:The new PHP by g8oz on Tuesday March 04, 2014 @09:42AM (#7340402)
I don't hear people complaining about Python's builtin webserver. Maybe thats because Python only attracts people who do things correctly right?
Re:The new PHP by samastur on Tuesday March 04, 2014 @09:48AM (#7340444)
Python doesn't have a builtin webserver, but there is one in standard library of CPython.

I've yet to see an article that would argue that its existence is a proof that you should be using Python now.

Re:The new PHP by girvo on Tuesday March 04, 2014 @10:07AM (#7340583)
Then you missed the point of the article, and also obviously don't use PHP regularly. It's a super handy feature.
Re:The new PHP by pekk on Tuesday March 04, 2014 @10:17AM (#7340653)
Python's stdlib webserver is terrible and not to be used. You WILL hear Python people say this

I don't see why you decided to pick a fight about Python, though - Python seems to be a sore point for PHP defenders and I really don't know why

Re:The new PHP by collyw on Tuesday March 04, 2014 @10:54AM (#7340931)
Nope, Python attracts plenty of idiots as well. It is especially popular among self taught bioinformaticians, who write really bad code.
Re:The new PHP by orf on Tuesday March 04, 2014 @08:59AM (#7340158)
No its like saying Home Depot shouldn't sell power tools to children who don't know how to safely use them.

Unless the web server displays a huge red message every time it is run saying "Don't even think about using this in production" you can bet that it will be.

Re:The new PHP by maratd on Tuesday March 04, 2014 @09:58AM (#7340531)
> Unless the web server displays a huge red message every time it is run

Uhh... this is the first line the web server spits out:

PHP 5.4.0 Development Server started at Thu Jul 21 10:43:28 2011

The manual isn't exactly vague on this point either:

http://us3.php.net/manual/en/features.commandline.webserver....

So we got the warning already in there, what else would you like?

Re:The new PHP by orf on Tuesday March 04, 2014 @10:27AM (#7340735)
20 words of that manual were dedicated to letting people know its not for use in production. Un-highlighted and buried at the end of a paragraph that I initially skimmed over and didn't even read. No attention is directed at it in any way.

So the server outputs a message. Great. Is it huge, red and says "do not use me in production"? No. Its a standard version banner.

Re:The new PHP by Gigablah on Tuesday March 04, 2014 @10:57AM (#7340953)
There's no pleasing you, is there?

Maybe we should add some <blink> and <marquee>?

Re:The new PHP by orf on Tuesday March 04, 2014 @11:40AM (#7341293)
Really? Look at the documentation page. The first thing you see is a huge chunk of text with absolutely no highlighting to guide you. Most people would just skim their eyes over that, and my attention gets drawn to the list of MIME types because it looks different.

Compare these two screenshots: http://i.imgur.com/Kzdphar.png http://i.imgur.com/CQnU8aG.png

A simple bold tag immediately draws focus and ensures that the huge majority of people who view the page get the important message. That's not being hard to please, it's just common sense.

Re:The new PHP by bmoresbest55 on Tuesday March 04, 2014 @11:14AM (#7341085)
I don't the person is being a pain. People will not heed a warning that is not clear and apparent. It's like the warning on the side a hot cup of McDonald's coffee. It's not paid any attention if it's not really, really, ####-->REALLY CLEAR<--#####.
Re:The new PHP by LawnGnome on Tuesday March 04, 2014 @01:44PM (#7342166)
Fair point. This is how that page will look after the weekly manual rebuild occurs on Friday: http://i.imgur.com/YXhafB5.png
Re:The new PHP by unfunco on Tuesday March 04, 2014 @01:56PM (#7342255)
I am of the opinion that it's simpler to write a basic PHP file than it is to configure Apache, Nginx, Lighttpd. I'd think that the majority of people running WordPress (likely the most distributed PHP project) are doing so on shared hosting, and not likely to want to or know how to configure their own server. The type of person interested in the built-in web server (a decent feature in my opinion, and comparable to `rails s`) is knowledgeable enough to know that the built-in web-server will not cut it for production traffic.
Re:The new PHP by userbinator on Tuesday March 04, 2014 @09:18AM (#7340258)
> The web server is explicitly for development purposes. It is not meant for production.

Doing that would mean the dev/prod environment is different, which is not that great of an idea. Keeping them as similar as possible leads to less chance of "but it worked on the dev server" sort of problems.

Re:The new PHP by Windwaker on Tuesday March 04, 2014 @09:28AM (#7340318)
It seems to me that PHP is pushing the built-in webserver to allow for accessibility, or "plug-and-play" if you will. Instead of having to go through having a LAMP setup everywhere you go, you can test code on the fly.
Re:The new PHP by dscrd on Tuesday March 04, 2014 @10:49AM (#7340897)
Is it really built-in to the language or just a library? Or is that boundary fuzzy with PHP?
Re:The new PHP by dd3141 on Tuesday March 04, 2014 @08:45AM (#7340087)
This. Can't agree more.
Re:The new PHP by JohnBooty on Tuesday March 04, 2014 @10:18AM (#7340660)
Having a built-in web server was a tremendous boon for Ruby on Rails. Anybody could run "rails new foo; cd foo; rails server" and run code without installing Apache and mod_whatever.

Regardless of what anybody thinks about Ruby developers, I've never heard or seen that "people launching production sites with servers intended mainly for Rails development use" is/was a widespread thing.

Re:The new PHP by debaserab2 on Tuesday March 04, 2014 @11:19AM (#7341139)
What? How often does that actually happen?

I don't think I've ever heard of new PHP devs "launching with the built in web server". Django has shipped with a built-in insecure web server for years and no ones crying to fix it.

There's things to fix in PHP, but this is not one.

Re:The new PHP by girvo on Tuesday March 04, 2014 @10:06AM (#7340574)
Considering the fact that I can set up a development environment in docker using PHP with a makefile and it's built in webserver, I'd say you've missed the point of it. It's a great addition, and with Composer/Packagist (which does currently have an issue with replacement packages, that needs to be fixed) plus the new features in 5.5, I can comfortably say I like using PHP.

Also, I've really got to stop reading the comments on PHP threads here on HN. They're repetitive, pointless and negative to the point of blindness. I'll go back to building cool things in it (and Go and Ruby and lately C, because while each of those have their issues they all serve a purpose and do it well).

Re:The new PHP by MAGZine on Tuesday March 04, 2014 @11:58AM (#7341413)
you mean where anyone can submit a package, and it's replacements will be taken into consideration globally?

Replace everyone's symfony security/auth module? what could possibly go wrong? :D

Re:The new PHP by girvo on Tuesday March 04, 2014 @08:27PM (#7344622)
Yes that :( so stupid.
Re:The new PHP by Gigablah on Tuesday March 04, 2014 @08:42AM (#7340065)
What makes you think a "clueless" dev is going to find out there's a built-in web server in the first place?
Re:The new PHP by Iftheshoefits on Tuesday March 04, 2014 @12:59PM (#7341824)
Have you seen any WordPress code? There are a lot of "clueless devs" who stumble upon the most wretched, ill-advised features of PHP and happily (ab)use them.

I have been under the impression that that was, in fact, one of the reasons PHP has such a bad reputation (rightly or wrongly).

Re:The new PHP by ajankovic on Tuesday March 04, 2014 @08:51AM (#7340111)
Or that dev is going to know what is web server.
Re:The new PHP by agumonkey on Tuesday March 04, 2014 @09:41AM (#7340394)
it's to isolate from system http server[1].

  Before : Install php, write php, install apache / mod_php, refresh.
  After  : install php, write php, refresh.
Nothing else.

[1] no need to install/configure a complex standalone server, focus on embedded thus more cohesive routing systems instead of fragile rule-on-top-of-regexps as seen in apache.

Re:The new PHP by userbinator on Tuesday March 04, 2014 @09:14AM (#7340235)
I don't think PHP needs a built-in web server, but for a different reason: there's already tons of others you can use with it.
Re:The new PHP by robryan on Tuesday March 04, 2014 @08:47AM (#7340092)
Isn't that pretty much what people use with rails? No one says that is overkill.
Re:The new PHP by garethadams on Tuesday March 04, 2014 @01:01PM (#7341840)
Has PHP decided whether it's a language or a framework yet?

EDIT: To clarify, a framework like Rails definitely has a place for including a web server.

Now Ruby has a lightweight web servers in its standard library (but not its core library). Maybe the problem people are seeing with the web server (and it's not a new problem) is the way PHP's core library contains so many things that other languages would leave out as optional includes.

Re:The new PHP by kiiski on Wednesday March 05, 2014 @10:41AM (#7347548)
I think the problem is more likely to be that people here are so predisposed against PHP that they only see the potential problems, and ignore the benefits.
Re:The new PHP by shocks on Tuesday March 04, 2014 @09:14AM (#7340229)
Umm, like Node?
Re:The new PHP by courtewing on Tuesday March 04, 2014 @09:57AM (#7340521)
Not really like node, no. The node http module is part of the standard library and you can use it to build a custom web server. The php web server is built into the php binary, and you can use it to serve up some portion of your filesystem as a PHP app.

So it's more like `python -m SimpleHTTPServer` than the node http module.