making bbPress (and WordPress) work better!

Author Archive

How to build HHVM 3.22 master trunk on CentOS 7

HHVM 3.20, 3.21 and 3.22 are still faster than PHP 7.2 especially with many connections under load, however as of October 2017 there still are no official pre-compiled HHVM packages for CentOS 7.x so we need to revisit how to build it by hand, which is not too difficult, just takes most servers awhile to assemble

There are instructions on the HHVM wiki for CentOS7 but they are a year out of date now.

The process is straightforward, first we need to not only make sure we have all the libraries we need but also the development libraries and most recently a newer version of the GCC compiler, we will use GCC 6.3 found in the official SCL Devtoolset-6 for CentOS 7 (trusted because it is built by Redhat/CentOS)

(more…)


How to fix “mutation operation” errors in Firefox

You may find at some point using firefox you are unable to access some websites which rely on complex javascript libraries. When you look at the errors on the page, you see:

A mutation operation was attempted on a database that did not allow mutations

The solution is to make sure dom.indexedDB.enabled is set to true in about:config

One example of a website with this problem is weather.com which will not display anything on the page unless this setting is enabled. Developers should wrap such function calls in try/catch or other error handling so your entire website doesn’t fail. Browser sniffing is not adequate.


Nginx 1.9.5 brings built-in HTTP/2.0 support, replaces SPDY

Nginx 1.9.5 will ship this month shipped 9/22 with new HTTP/2.0 support:
http://nginx.org/en/docs/http/ngx_http_v2_module.html

It replaces the SPDY module since they cannot be both active at the same time. HTTP/2.0 spec was finalized May 14th 2015 so it can now be implemented and standardized.

HTTP/2.0 features only work over HTTPS (tls/ssl) connections in most browsers which is unfortunate since virtually all WordPress based websites could benefit from the speedup.

There is a catch in that your server must use OpenSSL 1.0.2 or newer (or be backported with ALPN support ala Redhat)

Nginx must be compiled with

./configure --with-http_v2_module (etc.)

and then in your Server {} block replace spdy with http2

server {
    listen 443 ssl http2;

This demo claims to demonstrate how HTTP/2.0 is faster for many small elements on a page:
http://www.http2demo.io/

Firefox 36+, Chrome 40+ and IE11 (on Windows 10) currently support HTTP/2.0 over TLS
https://en.wikipedia.org/wiki/HTTP/2#Browser_support


PHP 7 Opcache adds Huge Pages support for extra performance

The PHP 7 opcache (open sourced by Zend, which replaced APC) gets a little performance boost from the added support of Huge Pages by Dmitry Stogov:

Added an experimental ability to move PHP code pages (PHP TEXT segment) into
HUGE pages.

; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
;opcache.huge_code_pages=1

Note that PHP must first be compiled with the appropriate configure option:

./configure --enable-huge-code-pages  (... etc.)

Essentially, Huge Pages (on OS that support them) reduces the size of the index that has to be searched to find allocated memory by allowing larger chunks of memory to be claimed instead of smaller blocks.

See the Debian wiki for a better explanation of huge pages:
https://wiki.debian.org/Hugepages

This will have to benchmarked to prove if it really enhanced performance and by how much (I suspect low single digits but everything helps).

Also new to PHP 7 will be a file-based cache for the opcache which can be used as either the primary or a secondary cache level: (more…)


New WordPress Attack Compromising 5000 Websites Every Day

There is a new WordPress attack going around and in the past two weeks it has taken off, infecting 5000 sites per day:

WordPress Malware – Active VisitorTracker Campaign

Its goal apparently is to redirect visitor browsers to a site that attempts all the latest breach hacks so their computer can be further compromised.

Scan your files (and perhaps database) for “visitorTracker_isMob”

grep -r "visitorTracker_isMob" *

or perhaps more specifically only .js files

grep "visitorTracker_isMob" -ri --include \*.js

PHP 5.4 reaches End-of-Life, PHP 7.0 release schedule filled, PHP 7.1 Branched

PHP 5.4 hit EOL yesterday (end of life). There will not be any further security updates for it. You should be using PHP 5.6 anyway, it is slightly faster.

http://php.net/supported-versions.php#layout-content

Meanwhile PHP 7.1 has now received its own branch and the rest of the release candidate schedule has been filled out on the timetable:

https://wiki.php.net/todo/php70#timetable

Sep 17 2015 PHP7 RC 3
Oct 01 2015 PHP7 RC 4
Oct 15 2015 PHP7 RC 5
Oct 29 2015 PHP7 RC 6
Nov 12 2015 PHP7 Final

So every other Thursday through November will bring more and more stability to PHP 7.0 which will be the most important PHP release since PHP 4


CURL broken in CentOS 7 / RHEL7 for past year

If you suspected maybe WordPress and other PHP apps were slower to ping/trackback sites and other fetches under CentOS 7 than CentOS 6, you aren’t imagining things.

Apparently libCurl (and therefore Curl in PHP) has been broken for over a year now without RedHat applying the available patch and pushing an update.

https://bugs.centos.org/view.php?id=8076

https://bugzilla.redhat.com/show_bug.cgi?id=1130239

patch: https://github.com/bagder/curl/commit/d529f388 (note July 2013)

(more…)


Google Apps for email (Gmail for your domain) blocks some legitimate mail by default

If you are using Google Apps for your domain name and gmail is your email service, then you aren’t getting important messages sent to “abuse” and “postmaster”.

Google intercepts all abuse@domain and postmaster@domain email and does NOT provide you with a copy by default! Thanks Google, ugh.

(more…)


To Save the Future of WordPress, Steal This Idea…

A Little History…

Nearly 13 years ago, Michel Valdrighi quietly added some code to his
program which unknowingly was to become one of WordPress’s greatest abilities:

http://cafelog.cvs.sourceforge.net/viewvc/cafelog/zerodotx/b2-include/b2template.functions.php?hideattic=0&r1=1.49&r2=1.50#l1057

That code commit back in October 2002 contans a single note: “now with b2_filter support !” – perhaps the exclamation point exposing a little thrill that this was something new and exciting, but I have to wonder if he could actually imagine what it really meant for the future.

In fact with the addition of those functions “add_filter/apply_filters” one can begin to easily recognize some of the oldest source code as WordPress itself, compared to earlier versions.

(more…)


Everyone can make their website HTTPS for free

In case you have not heard the amazing news, Mozilla, EFF, Automattic and a few other folks are banding together to help end the SSL certificate cartel by the end of 2015

https://letsencrypt.org/

This is huge. Everyone will be able to make their website HTTPS for free, without paying an annual fee and much easier than StartSSL

(more…)


PHP 7.0 Final will ship November 12th 2015

Very exciting to see the PHP team set the date for the PHP 7.0 final (gold) release.

https://wiki.php.net/todo/php70#timetable

Thursday November 12th – 90 days from today, mark your calendars!

It will be as if millions of servers cried out as their loads were cut in half.

The first PHP 7.0 release candidate will ship August 20th, 2015 (this coming Thursday!)

All changes to PHP 7.0 now are stabilization/fixes only (feature frozen).

In 30 days, on September 14th 2015, the PHP team will start the PHP 7.1 master trunk branch as PHP 5.4 is marked “end of life”

If you need legacy code support, be sure to read my post on how to put mysql functions back into PHP 7.0


WordPress 4.3 benchmark: HHVM 3.9 vs PHP 7.0

A casual Sunday morning benchmark for August 9th 2015 using latest builds:

1000 Front Pages of WordPress (virtually stock default install)
HHVM 11.99, 11.83, 11.81, 11.78, 11.85 seconds
PHP7 11.18, 10.95, 10.85, 10.96, 10.88 seconds

Using
WordPress trunk 4.3 RC2
HHVM trunk 3.9-dev
PHP trunk 7.0 RC1
(on CentOS 7)
(more…)


How to put MySQL functions back into PHP 7

PHP 7 will go “release candidate” on August 20th 2015 which is very exciting because it will instantly be twice as fast as PHP 5.6 (and all previous versions). PHP7 gives HHVM a run for the money and takes 5 minutes to compile instead of hours for HHVM.

But there is a catch – if you have any legacy code that uses the mysql_* functions, they will stop working entirely in PHP 7. Not just a warning, not just deprecated, but gone, fatal.

However, it is easy to get them back without using a wrapper or modifying your code…
(more…)


How to fix: Can’t see Unicode (UTF8) in Notepad++ on Windows XP

This is a little late to help most people because they have moved on from Windows XP to newer flavors, however there are still some die-hards going to 2019 with the simple PosReady registry tweak.

If you have a full unicode font installed like Symbola on Windows XP, you may still not see proper characters in applications like Notepad++ and instead get double empty boxes in their place.
(more…)


phpinfo page for HHVM HipHop Virtual Machine

So you finally got HHVM 3.2 installed and running
and instinctively go to your phpinfo page to check it out…

but there nothing there, only “HipHop” …disappointing isn’t it?

So I whipped this up real quick as a phpinfo replacement:

HHVMinfo on github or direct download

(more…)


Suhosin comes back from the dead, bringing security to newest PHP versions

수호신

While everyone has been distracted admiring PHP-NG, a great PHP project has quietly come back from the dead – Suhosin !

Suhosin is a well regarded security extension for PHP by Stefan Esser that had stopped getting updates after PHP 5.3. Perhaps it was due to more dramatic internal changes to the PHP core with 5.4 making it difficult to keep up. Linux distributions such as Debian that added Suhosin seeing its value, dropped it after updates stopped. Suhosin only worked up to PHP 5.3 – until now.

Suhosin can do neat tricks like disable EVAL and the regex /e modifier in PHP which the core of PHP cannot do by itself (or more accurately the core developers refuse to address). Suhosin also has many other options to help make PHP safer to use in a shared environment or where a server might be running a great deal of third-party code (ie. WordPress/plugins).
(more…)


How to build HHVM 3.8 on CentOS 7

2015 UPDATE: new wiki page for HHVM on CentOS7 with alternate instructions
—-
While building HHVM (HipHop Virtual Machine) for faster PHP on CentOS 6.x was pretty much a nightmare because almost none of third-party libraries are available from major repositories, the freshly released CentOS 7.0 solves most of this problem as it has far newer packages available from EPEL (because it has roots in more modern Fedora 19).

Note that unlike PHP/PHPNG, HHVM requires major resources to build. You may be used to making PHP in 15 minutes on a little old 256mb 1ghz box. You can forget that with HHVM which is a beast to compile. 1gb ram minimum and lots of cpu power required to keep it an hour or two (this is part of why PHP NG instead is so exciting because it will be so much easier to custom build).
(more…)


PHP NG within 10-25% of HHVM performance

Zeev Suraski (CTO of Zend and therefore an extremely qualified authority on PHP NG) has written a fascinating article comparing the performance of PHPNG against the current HHVM versions. A must read.

phpng-vs-hhvm

Perhaps even more importantly, he has written about the current state and future of PHP NG.
(more…)


PHP NG now nearly TWICE as fast as PHP 5.6

correction: php core developers have urged that it is improper to call this version “5.7” (despite the versioning file stating so)

PHP 5.7 PHP NG is still in alpha development, however it is starting to show breathtaking performance improvements over 5.6 while maintaining virtually complete compatibility.

Dmitry Stogov has been hard at work since his first announcement in mid-January 2014 and milestone update in early-May to keep folding in more and more ideas to increase PHP speed (with significant contributions by Xinchen Hui, Nikita Popov and others).

Six months later in mid-July, their efforts are really bearing fruit and PHP 5.7 NG is about to become nearly 100% faster than PHP 5.6 when rendering the front page of a stock WordPress 3.6 installation:

PHP 5.6, 1000 renderings of WP front page = 26.756 seconds

PHP NG,  1000 renderings of WP front page = 14.810 seconds

and he is not even done yet, based on all his proposals and notes as you can follow on http://wiki.php.net/phpng

(more…)


CentOS 7 to arrive in July with performance boost

Red Hat released RHEL 7 on June 10th which means the CentOS 7 community got to work, to prep their release based on the source. It is currently in “QA” release for review and will go to “GA” release (general availability) sometime in July.

The big news, at least for me, is performance improvements over CentOS 6.5
Red Hat claims 11% to 25% speed increase depending on workload:

Is that plausible from just an OS upgrade? Possibly, depending on better use of hardware and how much contention is going on. CentOS 7 will finally bring the linux 3.10 kernel to replace the 2.6.32 kernel in CentOS 6.5 – this means the elimination of the “big kernel lock” and better memory management.

7 will also bring the XFS filesystem as a default, alternative to EXT4. I am not sold on this change. I have seen a number of benchmarks that show EXT4 is faster in many cases, by a significant percent, over XFS (you can still use EXT4 of course). Apparently GRUB was also replaced with GRUB2 which is something I have to research and learn since it is critical for boot.

Want to read about all the new stuff for yourself?
Try the Red Hat release notes or save it for later in PDF format.

Initially there is no direct upgrade path for CentOS 6.5 to 7.
But they are discussing it and promise to explore after the GA release.


PHP 5.4, 5.6, 5.7 WordPress 3.9 Benchmark

update: now with PHP 5.7 (PHPng) comparison

Was really curious to follow up on PHP 5.6 with “real world” benchmarks so I built up a machine today for some quick’n’dirty tests. (I’ll add more tests to this at a later date as I have actual things to do this weekend and this was quite a bit of work).

Everything was allowed to pre-cache heavily, linux, mysql, php opcache, etc. this is just a raw php performance test (but no wp-cache, all dynamic pages)

Two tests: (for now)


1) directly calling the wordpress front page via php-fpm via the fcgi utility, which bypasses all of the web front end (nginx) so it is pure PHP speed

1000 passes (one pass at a time, single file asap via fcgi)
PHP 5.4 median = 28.562 seconds
PHP 5.6 median = 26.783 seconds
PHP 5.7 median = 19.405 seconds

 6.22% improvement with PHP 5.6

32.06% improvement with PHP 5.7


2) full web interface benchmark with logged in admin user, going into view “all posts” in the wp-admin backend (/wp-admin/edit.php) – this makes WordPress work really hard because it is loading all of the engine, plus the wp-admin code, plus authorizing the user via the cookie

1000 passes (one pass at a time, single file asap via curl)
PHP 5.4 median = 42.523
PHP 5.6 median = 39.455
PHP 5.7 median = 29.498

 7.21% improvement with PHP 5.6

30.63% improvement with PHP 5.7


environment:
Intel Quad Core i5 @ 3ghz
CentOS 6.5 64bit, MariaDB 10.0.11, Nginx 1.6.0, PHP 5.4.30/5.6.0beta4, Zend Opcache 7.0.4
WordPress 3.9.1 (stock with wp-cron disabled)

All built with GCC 4.8.2 and I made PHP 5.4 and 5.6 both use the same new Zend Opcache (because it is amazing)

I’ll do more comparisons and maybe even build PHP 5.5 at a later date.

Let me know if there are any specific requests for good things to compare.

Added PHP 5.7 (aka PHPNG) something to look foward to in 2015


PHP 5.6 enters final beta,  up to 10% faster than 5.4, 5.5

PHP 5.6 is about to enter its final beta this week or early next.

https://raw.githubusercontent.com/php/php-src/PHP-5.6/NEWS

It is now in “feature freeze” where only bug fixes will be applied to the code.

While PHP 5.5 was actually SLOWER than PHP 5.4 in some cases, it appears they have finally moved performance ahead with PHP 5.6 and informal benchmarks show it to be up to 10% faster than PHP 5.4 (and 5.5) using real-world code.

There will also be some further memory savings with how it handles strings and other data. Given the sheer size and bloat of modern WordPress, it will need every bit of help that PHP can throw at it, so I expect quick adoption on large websites.

Fortunately there are very few backward incompatible changes with PHP 5.6

http://php.net/migration56

The biggest “problem” will be deprecated warnings for users adapting to it from previous versions – but those warnings can be masked for now to reduce noise in error logs.

For example here is how I handle such noise on production servers via php.ini:

error_reporting = E_ALL & ~E_STRICT & ~E_DEPRECATED & ~E_NOTICE

The future of PHP looks quite exciting now with the recent proof-of-concept demonstrated via PHPNG (PHP next generation), where it might become 50% faster in some cases based on internal restructuring, memory handling modeled on jemalloc and just-in-time compiling. WordPress was already demonstrated to be 20% faster in an early experiment over PHP 5.5


Donate to OpenSSL

Virtually every open source OS and project on the web that uses encryption relies on OpenSSL. Yet they only get a few thousand a year in donations. Time to change that if we want better code: http://www.openssl.org/support/donations.html


Opcache Control Panel for PHP

With the first release of PHP 5.5 beta which includes the new Zend Opcache, I’d like to offer beta testers my free opcache control panel. It also works with PHP 5.4 and (in theory) 5.3

https://gist.github.com/ck-on/4959032/?ocp.php

or just right-click to download and save