My main worry with PHP is that its surface constantly grows. This means the language is
1. more complex to use (it took years for some parsers to implement the PHP 8.4 property hooks, and I suppose few people can explain how they work with inheritance and traits),
2. more costly to maintain (I remember when the developer of PHP's JIT left, the PHP foundation was worried because no one could understand the JIT code),
3. and has more security risks (critical security releases will continue).
I don't disagree with you, but the situation is more nuanced, and PHP's initial promises are now blurred.
> 1. A stateless functional core. It's cheap to run and quick to start.
Most modern codebases use a framework. And once you have to load Wordpress, Drupal, or even worse, Laravel, then it's no longer cheap and quick.
So PHP added several layers of complexity to mitigate this: an opcode cache, a code-preload system...
> 2. Every request has an environment created then torn down.
That's no longer always true. When the code preload is enabled, a request can leak into another.
> 3. Every request is single-threaded. [...] Async network/IO requests are handled via extensions.
You mixing up two different things. The default PHP SAPIs have single-threaded request handlers (though IIRC the default deploy stack of Laravel differs). But the language has a native async feature through Fibers, from which coroutines can be implemented (see amphp/amp).
So PHP on the server side is usually like JS on the client side (except for workers): single-threaded with async. Though I haven't seen much use of Fibers in the wild, it's in the language.
From your own source, a basic demo with Laravel peaks at 95 requests/s/core. It's worse with Wordpress at less than 20 r/s/core. That's slow.
The last round of TechEmpower web benchmarks computed the framework overhead. Depending on the task, the performance of Laravel was 5% to 20% of the native PHP code, i.e. 5 to 20 times slower.
Source : https://www.techempower.com/benchmarks/#section=data-r23&tes...
These benchmarks are garbage, the last round was nearly 2 years ago, there's no explaination of where the "performance scores" come from and the GitHub repo is archived.
The TideWays benchmark doesn't show the peak, it shows the rps for 15 sustained users.
> The TideWays benchmark doesn't show the peak, it shows the rps for 15 sustained users.
Yes. And it's also not entirely representative of a production set-up. As an example Vegata is running on the same machine as PHP and the same is true for the MySQL server used by WordPress and Laravel. The tests are also running against a - except for worker count - stock installation to possibly highlight improvements by better INI defaults in newer PHP versions. This is all good enough to compare the different PHP versions against each other, since they are all equally affected by this. But it is thus by no means representative of what you can get out of a properly tuned production setup.
Disclosure: I set up the benchmark and performed the measurements.
PS: It's Tideways, lowercase 'w'.
This is with just 15 concurrent users, we (one author of the benchmark) did not want to measure peak performance, just the relative performance between PHP versions.
The benchmarks show PHP itself isn't slow, but running WP or Laravel adds that initial load cost you mentioned. If your goal is cheap and quick without patching plugins, Hatamoto CMS uses just one Go binary plus Postgres so there is no framework overhead to start with.
Symfony with 35ms and Wordpress with 50ms in the 99th percentile is not significant though if we are talking about serving a web page with content to consume.
We have a Symfony REST API responding in 20ms for 30-40k requests per minute.
Yes there are use-cases outside this scale where Go (or others) is better suited from the start, but its not universal deal breaker.
> That's no longer always true. When the code preload is enabled, a request can leak into another.
That's in the same bucket (to me) as, say, L1/2/3 cache leaking between CPU threads. That's resulted in real attacks but it's not really the fault of my programming. I would rather the bug be in the language or the compiler/interpreter or even the framework because it's more likely to get found and fixed than if it was only code written by me for me.
As an aside, PHP eliminates a whole class of bugs that don't exist in, say, C/C++ eg string buffer overflows. Yes, the PHP engine can itself have buffer overflows but as per my previous point I trust the library developers and the volume of people who use and analyze it more than being totally correct with my own string handling.
> But the language has a native async feature through Fibers, from which coroutines can be implemented (see amphp/amp).
Only a single fiber runs your PHP request at any one time. This still fits the same model.
I thought mod_lua was an official module. I've just checked with Debian stable, and their "apache2-bin" package depends on liblua5.
> Apache has plenty of life left
I would expect a project with "plenty of life left" to support HTTP3. And to use Git (or some modern DVCS) instead of Subversion.
BTW, a co-worker has to maintain an Apache server because its shibboleth mod is mandatory for that project, and he often complains about it, and so do I when they ask for help. Performance is worse than nginx, configuration is awful, documentation is uneven, some features (like .htaccess) are dangerous, etc.
Apache http is the only project that I know that still uses Subversion. They have published a Git clone on Github, but their main source is still svn. It's a bit worrying, because they won't attract new developers with that technical stack. Last I checked, the 2.5 branch looked dead, and the dev-list was barely active.
For anyone not familiar with PHP, static analysis is pretty much required because the official PHP type system is minimal. The detailed types are added through phpdoc comments, and they also help IDEs to provide a sane completion. For instance, the plain "array" should be detailed with phpdoc:
/**
* @param array $input
* @return list
*/
function foo(array $input): array
{
foreach ($input as $string => $record) {
// IDE knows $record is an instance of MyRecord
The static analysis will use both type systems, and it's the only way to check that phpdoc are consistent. Psalm has various levels of strictness, and even at a very lax level, it can help detect errors or code smells.
There are two major static analysis tools for PHP, Psalm and PHPstan, both written in PHP. The latter used to be much slower, but last time I tried it there was little difference (about 20 s for 100k lines + dependencies).
My guess is that a new contender, Mago, written in Rust, will probably soon replace those other tools. Its commands (analyze, lint) are already almost as complete as psalm/phpstan. Though the migration won't be easy because it does not have a notion of levels.
Maybe "minimal" was not the right word. I hope the context made clear that I meant the type system was lacking even for basic uses. Here are 3 common cases.
Some PHP functions (e.g. opening a file) return a `resource` type, but PHP has no official way to declare it. So the right way is to declare `mixed` as an official type (which means `any`) and fix that declaration with a phpdoc comment.
Phpdoc provides generics (named "templates", à la C++), e.g. `iterable` where `iterable` is an official PHP type (which is awfully imprecise without phpdoc).
Phpdoc has tuples and (associative) array shapes, e.g. `@return list{int, \Error}`.
In past PHP versions, the type system was worse because the internal types were ambiguous: types were implicitly nullable, i.e. `string` meant `null|string`. When PHP gradually added sum types, they fixed that ambiguity.
That's exactly it but PHP Core refuses to address the typed array issue in wait for a consensus on Generics even though those two things serve different audiences.
I haven't actually run into a single issue with PHP's type system in the last few years. Literally the only thing that remains is typed arrays but that seems to be ways off due to fragmentation in how the core devs want it handled.
With how good PHPDoc and Phan are these days I don't really think about it anymore. You can sort of have typed array by implementing Iterator, Countable, ArrayAccess, and optionally Indexing but I assume you mean defining types of array values.
The static analyzer will say this is safe (sans a bleeding edge setting in PHPStan), but it will throw a type error when it runs. Because the string '1' is, despite having strict types enabled, still implicitly cast to the number 1.
Internally PHP has three distinct array types (the distinction is mainly for optimization purposes, it doesn't enforce anything): Regular arrays (continuous numeric keys), sparse arrays (all keys are integers but there can be holes) and hashmaps (anything goes).
I wish that the implicit casting you describe only happened in the two first case. In your example PHP already knows that $foo is a hashmap, so I'd want it to keep '1' as is!
Unfortunately for all of us, for every person surprised by this behavior, there's someone who relies on it. So it'll never change.
Best we can hope is to have better array types eventually (no, the SPL isn't it).
I had this happen to me yesterday in spite of knowing about it because I was rushing. I added phone numbers as array keys to deduplicate the whole set. Some ended up as ints and some as strings.
PHP arrays are the most versatile part of the language. They're what actually makes the language so good in so many ways.
But typed arrays are a freaking requirement at this point and I've been screaming about it for years now... alas no response.
It's a performance optimization in this case. '1' is a string and you can hash it like all the other strings with PHP's fork of djbx33a or you can immediately store it at memory index 1. PHP tends to have a lot of old code using numeric strings so the performance benefit of not hashing all of those is obvious.
pretty naive take, no run time guarantees, basically swinging on hope to keep your shit together. phpstan drops types on static analysis for deeply nested arrays/objects for example. or even those with many members.
final class Door {}
/**
* @template T
*/
final class Box
{
/** @param T $value */
public function __construct(private mixed $value) {}
/** @return T */
public function get(): mixed
{
return $this->value;
}
}
final class DoorInspector
{
/** @param Box $box */
public function __construct(private Box $box) {}
public function inspect(): void
{
$this->box->get()->open(); // analyser knows this is a Door
}
}
new DoorInspector(new Box(new Door())); // OK
new DoorInspector(new Box('not a door')); // error: Box given
You can even bind a template by a generic type with "of":
final class Door {}
/**
* @template T
*/
class Box
{
/** @param T $value */
public function __construct(private mixed $value) {}
/** @return T */
public function get(): mixed
{
return $this->value;
}
}
/** @extends Box */
final class DoorBox extends Box {}
/**
* @template T
* @template F of Box
*/
final class Shelf
{
/** @param F $box */
public function __construct(private Box $box) {}
/** @return F */
public function box(): Box
{
return $this->box;
}
/** @return T */
public function item(): mixed
{
return $this->box->get();
}
}
$shelf = new Shelf(new DoorBox(new Door()));
$shelf->box(); // DoorBox
$shelf->item(); // Door
I'm not the GP, but I did use Kitty, then switched to Ghostty. There were some great features (e.g. a shorcut to load the current terminal content in a text editor), some arguable points (e.g. Python is Kitty's script language and I had to use it to configure tabs to my taste) and some annoyances (I've had various crashes with Kitty's Debian package, though it did get stable in later years).
For me, the major pain was font rendering. I could not find a portable configuration that would work with any screen. And even worse, for some pixel densities, whatever configuration I tried, the result was awful. In some cases, I vaguely remember there was a legacy mode that made text legible, but it had its own problems.
As far as I know, there has been no proven vulnerability on a modern PHP (production) stack. The "Steal my Bitcoin" challenge was a toy project. The "lab" target used the embedded PHP server (`php -S`) which is for development only.
1. mod_php which is obsolete and requires Apache prefork (which should also be avoided)
2. php-fpm (FastCGI) which has been the default for more than a decade.
3. FrankenPHP is a new official interface much more suitable for containers.
There were 2 vulnerabilities.:
1. "OOM corruption".
The advisory says there was a proven exploit with mod_php, but only for that obsolete SAPI. "Source analysis therefore supports FPM as a susceptible, though *no complete FPM exploit* has been demonstrated for this SAPI."
2. "stale global state".
The advisory is
The last PHP release (8.5) was vulnerable when the debug parameter fatal_error_backtraces was on. There was a suspicion that an exploit could exist in the session code for php-fpm, but it was unproven and probably unrealistic.
The "evidence" given at the end of the article seems old news to me. The honeypot was based on Apache-prefork + mod_php. As stated in the CVE, there is a proven exploit for that (obsolete) stack.
From what I've read, the antisemitism during the Weimar Republic was mostly verbal. The government tried to fight it, but it was still growing. The situation changed very quickly in 32-33 when the NSDAP won the elections, built alliances to claim the power, then ended the Weimar Republic. But its first victims were the Communists, before the Jews.
It's not really as well researched as the Nazi period, but persecution of the Ostjuden began shortly after the end of WWI. It was indeed mixed with persecution of communists (because Eastern Jews were seen as foreign, communist influences), but the Osjuden were not communists as a category and were frequently attacked and interned outside of any discernible communist context[1][2].
>> They can use passkeys to prevent you from running unapproved software.
The expression was wrong, but the real meaning was described further in the post. The author meant that sites with passkeys can render unapproved software useless, in contrast to TOTP where any client is compatible.
> Visa transactions costs are 0,22 € out of a payment of 1 €, Mastercard's is 0,23 €, and the French CB network is 0,17 €.
Are you sure of these values? Because that's different from what I was told, which was that CB was cheaper for transactions of more than 10 €, because their fees were fixed, not rates like Visa and Mastercard.
From what I've just read (not counting the possible extra tax by the bank of the seller):
CB: 0.20% + 0.00117 € ⇒ 0.00317 € for 1 €, 0.20117 for 100 €
Visa: 0.20% + (0.01% to 0.014%) ⇒ up to 0.00214 € for 1 €, 0.214 € for 100 €
Mastercard: 0.20% + (0.15 to 0.17%)
The 0.20% is for the "interchange" described in the article. So it applies only when the seller and the buyer do not have the same bank. The maximal rate is fixed by the UE, and AFAIK everyone use the max value.
Yes perfectly sure, just checked. I'm not saying these are visa fees vs CB fees. Lots of actors in the chain. But that's what I'm paying for each card type.
1. more complex to use (it took years for some parsers to implement the PHP 8.4 property hooks, and I suppose few people can explain how they work with inheritance and traits), 2. more costly to maintain (I remember when the developer of PHP's JIT left, the PHP foundation was worried because no one could understand the JIT code), 3. and has more security risks (critical security releases will continue).
I don't disagree with you, but the situation is more nuanced, and PHP's initial promises are now blurred.
> 1. A stateless functional core. It's cheap to run and quick to start.
Most modern codebases use a framework. And once you have to load Wordpress, Drupal, or even worse, Laravel, then it's no longer cheap and quick. So PHP added several layers of complexity to mitigate this: an opcode cache, a code-preload system...
> 2. Every request has an environment created then torn down.
That's no longer always true. When the code preload is enabled, a request can leak into another.
> 3. Every request is single-threaded. [...] Async network/IO requests are handled via extensions.
You mixing up two different things. The default PHP SAPIs have single-threaded request handlers (though IIRC the default deploy stack of Laravel differs). But the language has a native async feature through Fibers, from which coroutines can be implemented (see amphp/amp).
So PHP on the server side is usually like JS on the client side (except for workers): single-threaded with async. Though I haven't seen much use of Fibers in the wild, it's in the language.
reply