Live data from Hacker News

PHP 7 deployment at Dailymotion

engineering.dailymotion.com

21–30 of 166 posts

Re: PHP 7 deployment at Dailymotion

#21
post #9

Earlier quoted context omitted.

At least this one isn't ripping it to shreds (so far). The other discussion...that was rough to read as a PHP dev.

I would assume by this point that PHP devs would be fairly confident and comfortable with their decision to continue with PHP and would be used to others bagging on it unnecessarily. As a JS/Web developer you learn to ignore the hatred of the web that it seems to get from the HN crowd.

>As a JS/Web developer you learn to ignore the hatred of the web that it seems to get from the HN crowd.

As an occasional full stack developer (not by choice), I can confidently say that the reason people hate on popular web tech is that it is uniformly terrible compared to non-web tech. I'm no fan of Java, for example, but I'll take it over PHP any day. JavaScript is so bad that I (and many other developers) will put a lot of effort into using any alternative, such as typescript, purescript, Elm, etc.

Re: PHP 7 deployment at Dailymotion

#22
post #12

I used to run one of my site (25K unique visitors a day) on PHP 5.3, when HHVM came out with stable version I shifted to HHVM and I had similar experience. Now I am running it on PHP 7 and I have to say I am more than happy with results. As much as PHP is not cool for today's developers it has served on some really high traffic sites and stayed useful even with the test of time. P.S. Now I wish somebody just implemen…

You may be looking for React PHP (http://reactphp.org). No relation to the JS library. It is an asynchronous event loop implementation, and there is a native HTTP stack built on top of it.

Re: PHP 7 deployment at Dailymotion

#23
post #9
post #5

Wow today is PHP day on HN :)

At least this one isn't ripping it to shreds (so far). The other discussion...that was rough to read as a PHP dev.

Take the attacks with a grain of salt, although many of the criticism is true, it is not exclusive to PHP, ex. the unexpected type coercions.

OTOH, most of the performance benchmarks done against PHP (ex. PHP vs Python) usually mean "which language is faster at crunching numbers". I/O operations like reading a file from disk or running a query against a database are an order of magnitude slower than number crunching, so any of the gains you can get by switching languages become effectively negligible, unless you really care about nanoseconds.

Remember to always pick the right tool for the job, you won't use PHP for number crunching the same way you won't pick C++ to build the minimum-viable-product website of a startup.

Re: PHP 7 deployment at Dailymotion

#24
post #17
post #14

Hack and HHVM solves what is, IMO, the worst feature of the default PHP runtime environment[0] - and that is the superglobals. It wasn't mentioned in the post from Slack, but default superglobals and the earlier register_globals design decisions are the worst and most impactful wart in PHP. Because it was designed as a templating language, the default web server interface, which is CGI - will auto-expose all variable…

Saying that superglobals are the worst thing about PHP is like saying "the worst thing about x86 Assembly is the mnemonics". It misses the point entirely. The worst thing about PHP is that it is fundamentally not well designed and therefore makes developing high-quality software much harder than it needs to be. It also makes developing extremely low-quality software easy, which could be good or bad depending on your…

You can make low-quality software in any language, PHP just happens to be easier to pick up.

Re: PHP 7 deployment at Dailymotion

#25
post #17

Earlier quoted context omitted.

Saying that superglobals are the worst thing about PHP is like saying "the worst thing about x86 Assembly is the mnemonics". It misses the point entirely. The worst thing about PHP is that it is fundamentally not well designed and therefore makes developing high-quality software much harder than it needs to be. It also makes developing extremely low-quality software easy, which could be good or bad depending on your…

You can make low-quality software in any language, PHP just happens to be easier to pick up.

By all means, but having the language nudge people in the right direction makes a world of difference.

PHP, much like Javascript is terrible for new developers for this very reason.

Learning a "good" language for lack of a better term is no more difficult than learning PHP/JS and is always worth the effort, if anything learning "good" languages is usually much easier because they are usually internally consistent.

Re: PHP 7 deployment at Dailymotion

#27
post #14

Hack and HHVM solves what is, IMO, the worst feature of the default PHP runtime environment[0] - and that is the superglobals. It wasn't mentioned in the post from Slack, but default superglobals and the earlier register_globals design decisions are the worst and most impactful wart in PHP. Because it was designed as a templating language, the default web server interface, which is CGI - will auto-expose all variable…

why not using filter_input or casting it ? e.g $userId = (int)$_GET["userId"]; and also when query to db using parameter binding ?

Re: PHP 7 deployment at Dailymotion

#28
post #25

Earlier quoted context omitted.

You can make low-quality software in any language, PHP just happens to be easier to pick up.

By all means, but having the language nudge people in the right direction makes a world of difference. PHP, much like Javascript is terrible for new developers for this very reason. Learning a "good" language for lack of a better term is no more difficult than learning PHP/JS and is always worth the effort, if anything learning "good" languages is usually much easier because they are usually internally consistent.

See I can't decide on this.

What is a good language? Java?

If all newbs picked up Java as language #1.. would their apps be better? Or would the really bad devs writing copy paste stack overflow code just be unable to understand it, so they would quit?

Like is it safer because it keeps out knuckle-draggers, or safer because it is actually safer? Cuz I can write some horrible Java code that will rival anything you can do in PHP

Re: PHP 7 deployment at Dailymotion

#29
post #14

Hack and HHVM solves what is, IMO, the worst feature of the default PHP runtime environment[0] - and that is the superglobals. It wasn't mentioned in the post from Slack, but default superglobals and the earlier register_globals design decisions are the worst and most impactful wart in PHP. Because it was designed as a templating language, the default web server interface, which is CGI - will auto-expose all variable…

While I agree that directly pulling things out of superglobals is dangerous, I disagree that it should be removed, lest you end up with a python2/python3 situation.

You can't just run around breaking BC of the language every time something is unideal.

Yes, there are a lot of ways to easily create security holes. This is what code review is for. I'm also not going to advocate abandoning C/C++ because "it's easy to create security holes" i.e. overflows.

Re: PHP 7 deployment at Dailymotion

#30

> It took less than a week to migrate our codebase (a 10 years old PHP monolith)... > And it took 4 hours to migrate our custom extensions. That seems like a very small amount of work; I'm impressed at how smooth a transition that must've been. I'm also quite surprised that > we can handle twice more traffic with same infrastructure. Wow, I didn't think that PHP application code would be such a bottleneck. Maybe it's…

have you ever loaded a stock magento server? Set it up, add maybe 10 products with basic images, and turn it loose.

Give it a reasonable box. 2 CPU cores, 2 GB of ram.

You are capped at something like 3-5 requests per second, with an average load time of 5 seconds..

Just blows my mind. Simple Java web app on the same server is doing 500 requests per second. Python app, with the horrible gil and all that nasty is going 200 requests per second. And magento is rocking 3 requests per second??!?!?!?!?!

I wonder how much global energy consumption would go down if PHP was not a thing.

Post reply on HN