Live data from Hacker News

An Internet of PHP

timotijhof.net

161–170 of 333 posts

Re: An Internet of PHP

#161

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…

You can also use nginx’s unit docker container, which hosts php’s interpreter in the nginx process.

https://unit.nginx.org/installation/#installation-docker

Re: An Internet of PHP

#162
post #144

Earlier quoted context omitted.

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

I agree that the language itself has many warts and the standard library is what it is, but I found the modern PHP developer experience and tooling is surprisingly good. At least when working within the Laravel ecosystem.

Re: An Internet of PHP

#164
post #137
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.

I don't think the language is the problem. As bad as it is, it is certainly more well thought that the original JavaScript. But PHP is used mostly by "businesses" with no budget and this is essentially the absolute rock-bottom of the "software" industry.

I think the language is the problem in some key areas. I started using PHP at the tail end of 2.x and remember trying to get a couple of endemic sources of bugs fixed in 3.x: register globals, requiring constant diligence NOT to ignore errors, and inconsistencies around things like parameter ordering for array functions or magic type conversion. Every time, it got pushback from someone saying it’d break too much code – at a time when there were billions of lines less PHP in the world, and when those were causing high profile security issues and app failures. I ditched PHP in the 2000s after getting tired of that, but picked up a legacy project a couple of years ago. Register globals is finally gone but everything else which I remember causing having to carefully train developers to avoid in the 90s is still a rake in the grass today.

Re: An Internet of PHP

#165

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…

Well, I used to do PHP back in the day, and I know the language has changed and evolved a lot, but I've looked at Laravel thinking it would be something cool and interesting and productive, and it seems bewildering and bloated. Doing one simple thing seems to take a mountain of incomprehensible overhead.

Not to say it's bad, but even with some experience, I couldn't grok it.

Re: An Internet of PHP

#166

For those of you who are proponents of other web ecosystems, I’m curious what benefits you enjoy? What framework or language do you use and what makes it great? I use PHP everyday but we definitely have a lot to learn from others.

Starting from 1997, over the years I completely replaced PHP with Python. Apart from the language itself, which I like a lot for many reasons, some benefits that come to my mind:

    - Better libraries and frameworks overall
    - Better programmers overall, so more competent colleagues
    - Relevant in many fields outside web development
    - Allows to learn and use various paradigms, like async/multithread/multiproc...
I do keep track of PHP improvements. In fact, I keep a small personal toy framework as a way to test its new features. Some of these were very much welcomed, like safe mode + runtime typing. But some of these were just catch-ups and none of these are compelling enough so that I would want to start a new project in PHP.

Other ecosystem I'm interested in is Go, for other reasons.

Re: An Internet of PHP

#167
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 is awful on its own. Forget production usage, it’s hard to even use for a quick bit of E2E testing.

Unfortunately it has some really opinionated routing rules with certain file extensions, preventing you from having a dynamic URL with something like a .json or a .xml extension. Instead it will always try to look up a static file of that and serve it instead.

I can’t find the bug tracker issue for it but it was closed out with a message along the lines of “don’t use the built in web server for anything besides a toy”.

Luckily there are plenty of PHP Cli based web servers now that some other commenters have mentioned.

Re: An Internet of PHP

#168
post #119

As an ex-PHP developer (almost 10 years now), I do not miss it. As a language, it is a scripting language with an okay interpreter. But as an eco-system, it is a hot mess. It has both the worst software developers (and I was one of them) as well as the worst clients (and the cheapest, regardless of geography). It is not a surprise that PHP is running the web. That's because WordPress made sites/e-commerce accessible…

This just reminds me of what originally got me into PHP as a teenager. Creating a site for our gaming community in PHP-Nuke was all too easy. Extending it with plugins, and eventually writing my own plugins to show live data from our game server. Now I look back on PHP3/PHP4 with disgust. Globals, function names, massive pieces of code right in the middle of HTML, shell_exec.

> Globals, function names, massive pieces of code right in the middle of HTML, shell_exec.

And they're not inherently bad.

PHP made the internet fun. Anyone could get going with a PHP enabled host with by creating an HTML document starting with and have a working something that the world could see by end of the day.

Today's web development feels like such a drag. In that you need to choose the scaffolding, create the scaffolding, wait for the concrete to dry, drill holes for the infrastructure and then construct the infrastructure.

When you then go to connect the infrastructure you find that one of the girders has buckled which requires a patch-up or refactor. Someone's misprinted the blue-prints and the cable ferret has gotten lost down one of the connectivity holes. You then discover that a new scaffolding company has come to town so your construction is now obviously out of date.

PHP enabled you to have something cool in days. Nowadays you spend days just trying to setup react. my two cents.

Re: An Internet of PHP

#169

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…

Out of curiosity, in your projects where you use PHP with frameworks such as Laravel, do you do server-side rendering, or SPA applications? I prefer the former but I wonder what's the trend now for the people into Symphony, Laravel, etc.

Re: An Internet of PHP

#170

Earlier quoted context omitted.

> The ability to interleave code and HTML was also tacky and never taken seriously And yet people would take a bullet for React and the JSX templates.

I too find this hilarious. Not because I want to defend PHP, but moreso that I personally sort of despise react and it's whole ecosystem. I've never liked writing code less than when dealing with a spaghetti monster react app.

Well React was born in Facebook which was famously PHP codebase. It makes sense.
Post reply on HN