zlacker

[return to "PHP 8.2"]
1. user39+j7[view] [source] 2022-12-08 13:16:18
>>TimWol+(OP)
The worst part about PHP is constantly hearing from its detractors, who are often people who haven’t used the language in many years. Haystack needle order, $, fractal of bad design, it just gets old.

The language isn’t perfect but I love working with it, these 8.1 and 8.2 improvements have really made it sweet.

My biggest gripe at the moment is the (very old) behavior of e.g. preg_match() and sort(). You’ve got a small handful of these common functions that operate on their input by reference/in place which is gross. A new version of these would be welcome.

◧◩
2. osrec+Xc[view] [source] 2022-12-08 13:57:39
>>user39+j7
The truth is, no language is perfect.

PHP just happens to be good at getting stuff done fast, so it's found all over the place, and thus has a lot of eyeballs on it. The negativity is a byproduct of it's usefulness and staying power - the price of popularity, if you will.

I love PHP, especially with the new event loop based modules that let you do things asynchronously, much like Node or Go.

If you know how to use it well, PHP is awesome, and it's getting better with each release.

◧◩◪
3. PaulHo+Qd[view] [source] 2022-12-08 14:04:01
>>osrec+Xc
PHP was the first open source language in which just anybody could write server-side web applications without terrible management problems for the sysadmin. First people wrote cgi-bin scripts in Perl, which were not efficient because they forked a process for each request. There was mod-perl which was more efficient but prone to memory leaks. A few people wrote cgi (or fast-cgi or Apache module) programs in C/C++ but that was insane since a return after a 𝚜𝚝𝚛𝚌𝚙𝚢 is Turing complete in C and there weren't any mitigations for this in the 1990s.

PHP opened the door to cheap web dynamic web hosting and in turn you had self-hosted applications like Wordpress. It was a few years later that languages like Java and C# became really attractive for back end work, you also had Ruby, Node, etc.

I wrote a lot of PHP in the early 2000s because that is were the work was, that’s what you could write open source code that people would use in, and it was really straightforward to build apps (like a social network for a secret society) without an ‘ops’ team watching your every move.

◧◩◪◨
4. tyingq+FL[view] [source] 2022-12-08 16:48:42
>>PaulHo+Qd
"First people wrote cgi-bin scripts in Perl, which were not efficient because they forked a process for each request"

I don't recall the sequence of events that way. That is, there was regular cgi, then mod_php with problems similar to mod_perl...then later fastcgi options existed for both.

◧◩◪◨⬒
5. torste+1N[view] [source] 2022-12-08 16:54:46
>>tyingq+FL
Wait. Isn't fastcgi essentially the same as mod_php? IPC with a long-running process rather than forking and capturing stdout?

What's the newer fastcgi php method that isn't mod_php?

◧◩◪◨⬒⬓
6. dysarr+fN[view] [source] 2022-12-08 16:56:21
>>torste+1N
FastCGI and mod_php are both ways of running PHP on a web server, but they differ in how they achieve this.

FastCGI is a protocol that allows a web server to communicate with external programs that provide dynamic content, such as PHP scripts. In FastCGI, the web server launches an external program, called a FastCGI process manager, which is responsible for starting and managing a pool of long-running PHP processes. When a request for a PHP script comes in, the FastCGI process manager assigns one of these processes to handle the request, and the process generates the dynamic content and sends it back to the web server.

mod_php, on the other hand, is an Apache module that embeds the PHP interpreter directly into the Apache web server. This means that PHP scripts are executed directly within the Apache process, without the need for an external process manager.

While both FastCGI and mod_php are ways of running PHP on a web server, they differ in their implementation and how they handle requests for PHP scripts.

◧◩◪◨⬒⬓⬔
7. torste+pU[view] [source] 2022-12-08 17:30:30
>>dysarr+fN
Is there no rule about GPT/bot responses on HN?
◧◩◪◨⬒⬓⬔⧯
8. dang+Q71[view] [source] 2022-12-08 18:41:42
>>torste+pU
We don't allow bots on HN and ban such accounts.
◧◩◪◨⬒⬓⬔⧯▣
9. torste+rp1[view] [source] 2022-12-08 20:01:39
>>dang+Q71
One ChatGPT reponse to:

> Write an explanation for the user who posted the following comment: "Wait. Isn't fastcgi essentially the same as mod_php? IPC with a long-running process rather than forking and capturing stdout? What's the newer fastcgi php method that isn't mod_php?"

is:

> FastCGI and mod_php are similar in that they both use a long-running process to handle PHP requests, rather than creating a new process for each request. However, they differ in how they are implemented and how they interact with the web server.

FastCGI is a protocol that allows a web server to communicate with external programs, such as PHP, to handle dynamic content. It is typically used with web servers such as Apache or Nginx. In the case of PHP, the web server uses FastCGI to send PHP requests to a PHP-FPM (FastCGI Process Manager) process, which then executes the PHP code and returns the result to the web server. This allows the web server to handle multiple PHP requests simultaneously, improving performance.

On the other hand, mod_php is an Apache module that embeds the PHP interpreter directly into the Apache web server. This means that Apache can handle PHP requests itself, without the need for external programs or FastCGI.

[go to top]