After several candidate version iterations, PHP 7 was officially released on December 4th. The most notable aspect of PHP 7 is undoubtedly its performance. According to official statements, PHP 7's performance is twice that of PHP 5.6.

Download address:PHP Download Address

The following content is excerpted from an article by Hui Xinchen, a core member of the PHP official development team.

To fully demonstrate the best performance of PHP 7, here are a few tips for everyone:

1. Remember to enable Zend Opcache, because PHP 7 is faster even without Opcache enabled than PHP 5.6 with Opcache enabled. So during the earlier testing period, some people never enabled Opcache. Enabling Opcache is very simple: add the following to the php.ini configuration file:

zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1

2. Use a newer compiler; GCC 4.8 or above is recommended, because only with GCC 4.8 or above will PHP enable Global Register for opline and execute_data support. This will bring about a 5% performance improvement (measured in terms of WordPress QPS).

3. Enable HugePages on the server, and then enable Opcache's huge_code_pages. Taking my CentOS 6.5 as an example, allocate 512 reserved huge pages via: "sudo sysctl vm.nr_hugepages=512", then in php.ini: "opcache.huge_code_pages=1". In this way, PHP will store its own text segment as well as huge memory allocations using large memory pages, reducing TLB misses and thus improving performance.

4. Enable Opcache File Cache (experimental). By enabling this, we can have Opcache cache the opcode cache to external files. For some scripts, this will bring significant performance improvements. In php.ini:

opcache.file_cache=/tmp