HHVM 的後續

官方對於 HHVM 的未來提出了說明:「The Future of HHVM」。重點就是他們不打算以 PHP7 為目標,打算關起來自己玩...:

Consequently, HHVM will not aim to target PHP7. The HHVM team believes that we have a clear path toward making Hack a fantastic language for web development, untethered from its PHP origins.

如果以 Packagist 上的資料來看 (PHP Versions Stats - 2017.1 Edition),HHVM 的數量應該是沒人了:

And because a few people have asked me this recently, while HHVM usage is not included above in the graph it is at 0.36% which is a third of PHP 5.3 usage and really hardly significant. I personally think it's fine to support it still in libraries if it just works, or if the fixes involved are minor. If not then it's probably not worth the time investment.

Comment 的地方有註明這是扣掉 CI 的量:

@ocramius: These numbers ignore Travis CI and other CI systems that set the "CI" env var in their workers. Without excluding those HHVM is around 0.95% so it's still low but those .36% is probably actual usage.

這樣就放心可以完全不用管 HHVM 了 XDDD

Apache 2.4 的 ProxyPass 對 Unix Domain Socket 的 FastCGI 界面設定

出自「High-performance PHP on apache httpd 2.4.x using mod_proxy_fcgi and php-fpm.」這邊的方法:

ProxyPassMatch ^/(.*\.php(/.*)?)$ unix:/var/run/php5-fpm.sock|fcgi://127.0.0.1:9000/var/www/www.example.com/public/

後面那個 127.0.0.1:9000 看起來變成裝飾用,有點奇怪... 不過至少會動?

PHP 5.4 的 json_encode 增加 JSON_UNESCAPED_SLASHES...

剛剛翻資料發現 json_encode 奇怪的老問題總算有解...

這樣的程式碼:

<?php
echo json_encode("http://www.google.com/"), "\n";

會輸出這樣的結果:

"http:\/\/www.google.com\/"

這是合法的 JSON 沒錯 (JSON 規格允許 string 裡面使用 \/),但看起來就很不爽啊,明明 / 就是可以合法輸出的字元... 然後剛剛看到 PHP 5.4.0 加上這些東西:

JSON_PRETTY_PRINT, JSON_UNESCAPED_SLASHES, and JSON_UNESCAPED_UNICODE options were added.

測了 JSON_UNESCAPED_SLASHES,看起來舒服多了:

<?php
echo json_encode("http://www.google.com/", JSON_UNESCAPED_SLASHES), "\n";

輸出結果是:

"http://www.google.com/"