Live data from Hacker News

An Internet of PHP

timotijhof.net

101–110 of 333 posts

Re: An Internet of PHP

#101
post #71

I like PHP, one issue which I face with PHP though is, that it is difficult to create a self-contained docker image. With node.js or java spring boot i can build an application with an http endpoint and create a single docker image with all included easily. With php I need 2 distinct containers, e.g., nginx, php-fpm and the code mounted on a volume to the the containers. So it seems to be more difficult for setup and…

PHP has had a built-in web server since version 5. People use Apache or nginx because they want to, but because they need to.

The built-in web server can only process one request at a time.

Re: An Internet of PHP

#102

I like PHP, one issue which I face with PHP though is, that it is difficult to create a self-contained docker image. With node.js or java spring boot i can build an application with an http endpoint and create a single docker image with all included easily. With php I need 2 distinct containers, e.g., nginx, php-fpm and the code mounted on a volume to the the containers. So it seems to be more difficult for setup and…

Had good success using Nginx Unit (distinct from normal nginx) for this. There's a unit-php docker image that can be used.

Re: An Internet of PHP

#103

At the end of the day if your software works and users like it, does the programming language even matter?

It does matter. I can't offer an opinion on the modern state of PHP since I'm not familiar with its recent developments. However, it's true that certain programming languages and frameworks can facilitate writing maintainable, secure code, while others might naturally foster problematic, insecure code. It isn't to say that you can't write good code with them, but it can be unreasonably difficult.

Take, for instance, the PHP environment around the time the "a fractal of bad design" (https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/) article was published — which also coincides with the last time I worked professionally with PHP. During that period, PHP was plagued with inconsistencies, a tendency to hide errors, and insecure default settings, all of which encouraged writing bad, unmaintainable, and insecure code. Those aspects truly matter.

Re: An Internet of PHP

#104
post #67
post #3

I love and use php but this article feels more like propaganda.

This doesn't make sense as a criticism. What do you think a blog post or an essay is?

To declare that blog posts, essays and propaganda are functionally the same thing is wickedly cynical, don't you think?

Re: An Internet of PHP

#105
From php.net home page: « PHP 8.2 is a major update of the PHP language.It contains many new features, including readonly classes, null, false, and true as stand-alone types,… » That says all for me. Doesn’t matter if it powers half the web. It’s an awful programming language.

Re: An Internet of PHP

#106
One thing I really dislike about PHP is the global scope and imports. Introduction of namespaces is an improvement but it does not change the fact that everything is in global scope. The best practice for imports is to not include them outside of execution context, but it also makes it very hard to reason about what is actually being used by the file + you try to think about not loading files unnecessarily so it's not uncommon to add the import statement in the same file multiple times before using something and there are no type hints that say whether the include was imported or not. Which is more or less a consquence of the environment not having a proper runtime and everything being re-initialized with every request (in a runtime context, all files that would ever by used would be included, because they would be used eventually). I genuinely wonder how it came to be that a language developed specifically to serve web requests is not a loop, you would think that a runtime would be especially useful for handling requests and Facebook learned it the hard way, heck CLI input -> output programs are probably the only type of program where it would not be a limitation.

Re: An Internet of PHP

#107
post #99

Earlier quoted context omitted.

Your comment articulates my thoughts on PHP very succinctly. Especially the culture fit bit. PHP is so insanely pragmatic that if someone looks down on it due to false preconceived notions then they're not the kind of person I can probably work happily with anyway. It's also the thing I'm best at!

And they are humble. They know their state, the flaws in their language and the long problematic history they have. They cherish their languages but are not fanatics.

PHP has its fair share of snobbery as well. Non-framework devs look down on Symfony, who in turn look down on Laravel devs, and everybody looks down on WordPress devs.

Re: An Internet of PHP

#108

From W3Tech; > PHP is used by 77% of all the websites whose server-side programming language we know. I had a quick look at the methodology section, but it’s not clear to me how accurate this data is. Determining whether a site uses PHP can be relatively straightforward (especially with default extensions / if Wordpress is used / etc), but if a site (potentially using a different language) is behind a reverse proxy/u…

It sounds like you're ultimately just saying that the 77% number doesn't feel right to you.

I agree that it's an interesting challenge to try to determine which language a large number of sites are using for the backend, or at least it would be a challenge in some small but maybe not insignificant percentage of cases. And no doubt whichever way they solved it involved compromises.

But that by itself doesn't give us enough information to draw conclusions about accuracy.

Re: An Internet of PHP

#110
I like PHP, because it has a familiar C-like syntax and great tooling, like composer, and frameworks, like Symfony. The language has warts, but it's improving.

I think its strength is its architecture, namely shared-nothing state and concurrency at the web-request level. [1]

[1] https://slack.engineering/taking-php-seriously/

Post reply on HN