Live data from Hacker News

An Internet of PHP

timotijhof.net

151–160 of 333 posts

Re: An Internet of PHP

#151
post #146

Earlier quoted context omitted.

A good programmer doesn't really care about the langage itself, but rather whether the language is the right tool for the job. For example, Erlang is painful to adapt to, but in some cases (example: if you build a Messenger app) it will be the best. It doesn't mean that Erlang is a bad language at all, it is designed for a main purpose in mind. It's normal to see junior developers and low-quality packages in PHP, Jav…

It's not any different to my point. You can use a hammer to hammer in a screw it doesn't make it fit for the job but it will work up to a certain extend. Similarly you can make a messenger app in PHP but you are better off using Erlang or maybe Node.

Absolutely agree.

Re: An Internet of PHP

#152
Unfortunately, the current maintainers of PHP have not learned from the success of it. And are driving PHP into the direction of having the rigid structure that Java has.

It is so successful because people who build new things are different from people who are paid to maintain old things. That is why WordPress, Wikipedia and countless other successful internet projects have been created using PHP and not using Java.

People who build new things like simplicity and elegance and tools that empower them. While people who are paid to maintain old things like a rigid structre which gives you the feeling of "nothing can go wrong".

Also, people who build and run things do not like breaking changes of their stack. While people who are paid to maintain old things don't care about breaking changes in their stack. Because they are paid to then work around those changes.

In the last version (8), PHP has introduced a ton of breaking changes which makes the language more rigid. And therefore less useful to build new things and more cumbersome to maintain:

It broke the order of parameters in join statements.

It broke calling static functions without the need to declare them as static.

It broke adding properties dynamicly to objects.

It broke easy string handling for many functions where null was rendered as an empty string. This is especially annoying as you often get null values from the database. It makes sens to have a value for "Don't know the color of the car" in the DB. And it makes sense to render it as "Color: " in the user interface. The easy string conversion always was one of the strengths of PHP. Why is it sabotaged now?

Some of these changes have been objected to by the original developer of PHP and long standing contributors like the author of xdebeug, PHP's most popular debugger. Yet they have been implemented.

The big danger is that this trend continues and existing PHP projects will be choked to death by more and more breaking changes. Changes which have to be worked around by making the code of the projects more and more bloated.

Re: An Internet of PHP

#153

Earlier quoted context omitted.

Well it's not exactly secure by default. I was deploying an app to a new server and some bot grabbed my .env file before I finished the Apache config. Ultimately it's my own stupidity, but you don't have to worry about that with most other languages

Yes but that’s a framework specific issue. And usually your documentroot would point to a directory below that which holds .env. Oh the memories of apache and php.

The mere concept of a "document root" is a problem though and a major footgun if you don't know what you're doing.

Every other language acts as its own web server which wouldn't even be capable of serving files even if you tried; the only thing it does is respond to web routes defined by the application.

This eliminates a whole chunk of security issues, from the one described above to malicious file uploads (PHP is probably the only language where a malicious file upload leads to RCE by default - other languages could happily accept and serve the malicious file back but wouldn't execute it).

Re: An Internet of PHP

#154

Earlier quoted context omitted.

Well the problem is that "the internet" (google, stackoverflow) does not (by default) filter out any old/obsolete information. People googling for solutions will get 30+ year old "advise" on how to do certain things / use certain libraries etc. Especially StackOverflow should be incorporating a major version number for which the question is valid. So yes, "PHP is still dead" as long as you get the same old advise.

that's very true. But it is true for PHP as it is for any other language or tech that is at least a decade old. Interesting fact: chatgpt can recognize old stuff and give better recommendations

Still, somehow it’s more true for php.. maybe because other languages invest more in migrating to newer standards. Maybe because so many projects are self-hosted by non-programmers, in which case it makes sense to be conservative

Re: An Internet of PHP

#155
post #120

Earlier quoted context omitted.

Modern PHP may as well be a new language. But then node came along. It's almost like PHP users couldn't stand a clean ecosystem.

NodeJS is the new PHP aka it's the first language someone who want to "web stuff" pick up. A decade ago most blog post about PHP had major security issues because the people who wrote those posts were just learning the ropes and copying each other in the same way most tutorial about react these days don't care about cleaning themselve up, unit testing and all that stuff that make the difference between a cowboy and a…

I wonder how many more years it will take HN to stop pointing out client development idiosyncrasies when comparing Javascript to a language like PHP that has no client development story at all when supposedly trying to compare server-side DX.

Re: An Internet of PHP

#156
post #144

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.

Can you explain why you think it’s an awful language? It definitely used to be lacking in features, but the improvements in the recent versions have been great.

Developer experience is awful. Variable names starting with $, heavy object orientism that seems like an after thought, tooling ecosystem is subpar, standard library is a joke, etc It’s a pile of crap and that’s my opinion

Re: An Internet of PHP

#157

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…

Yes- apache with mod_php. It's the most common deployment by far.

Re: An Internet of PHP

#158
Ironically enough, if people actually tried PHP, many would be amazed, especially at the quality frameworks. Productivity is very high in something like Laravel, and compared to JavaScript frameworks PHP frameworks are much more feature complete and well though out.

I'm a big fan of trying out different stacks, and I think a lot of people would love Laravel if they tried it. Give it a shot using PHPStorm and Laravel IDEA (free trials for both), and see what you think. Can't hurt.

Re: An Internet of PHP

#159

I've always liked PHP. You wouldn't pick it for your job interview's coding test if you had a choice (Python all the way there), but it's so intertwined with the internet and what we've learned about programming over the years. First mover advantage kind of deal. And I've never had to deal with ESM/CJS/AMD whatever module nonsense with PHP. No transpiling anything, just edit and refresh. And so many useful functions…

[deleted]

Re: An Internet of PHP

#160

Unfortunately, the current maintainers of PHP have not learned from the success of it. And are driving PHP into the direction of having the rigid structure that Java has. It is so successful because people who build new things are different from people who are paid to maintain old things. That is why WordPress, Wikipedia and countless other successful internet projects have been created using PHP and not using Java.…

[deleted]
Post reply on HN