


PHP 8.0 source code compilation and installation and JIT early adopter
Special Skills Guide
PHP 8.0 Alpha 1 has been released on June 25, 2020. Today I will share with you the most simplified PHP 8 Source code compilation and installation method to quickly try out the new feature JIT of PHP 8.0.
Operating system: CentOS Linux release 7.4.1708 (Core)
GCC: 4.8.5 20150623 (Red Hat 4.8.5-28 )
PHP version: php-8.0.0alpha1
1. Download page
https://downloads.php.net/~pollita/
2. Download PHP 8.0
wget https://downloads.php.net/~pollita/php-8.0.0alpha1.tar.gz
3. Unzip
tar -zxvf php-8.0.0alpha1.tar.gz
4. Create a new installation directory
Since multiple PHP versions coexist on this machine, it is necessary to create a meaningful directory, a directory name that can be known without thinking about the PHP version.
mkdir -p /usr/local/php80
5. configure options
This is a simplified version of the configuration options, a richer description of PHP configuration options: https://www.php.net/manual /en/configure.about.php
cd php-8.0.0alpha1 ./configure --prefix=/usr/local/php80/ --enable-debug --enable-fpm --with-config-file-path=/usr/local/php80/etc/ --with-config-file-scandir=/usr/local/php80/etc/php.d/
If you encounter the prompt configure: error during the configure process, pay attention to the error details below. The following lists a summary of key information for error conditions that occur during the configuration process. For other error conditions not listed, the solutions are the same:
Error #1:
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met: No package 'libxml-2.0' found
Solution:
yum install libxml2-devel.x86_64
Error #2:
configure: error: Package requirements (sqlite3 > 3.7.4) were not met: No package 'sqlite3' found
Solution:
yum install sqlite-devel.x86_64
If you see the following prompt message, it means that the configure step has been successful.
6. Compilation & Installation
make
The time consumed in the make phase is related to the machine configuration. If you see the following information, Indicates that the make phase has been completed.
Build complete. Don't forget to run 'make test'.
make test Since this is an early adopter, this step is omitted.
make install exit 0; -v -d /home/fanjiapeng/php-8.0.0alpha1/Zend/zend_ini_parser.y -o /home/fanjiapeng/php-8.0.0alpha1/Zend/zend_ini_parser.c Installing shared extensions: /usr/local/php80/lib/php/extensions/debugnon-zts-20190128/ Installing PHP CLI binary: /usr/local/php80/bin/ Installing PHP CLI man page: /usr/local/php80/php/man/man1/ Installing PHP FPM binary: /usr/local/php80/sbin/ Installing PHP FPM defconfig: /usr/local/php80/etc/ Installing PHP FPM man page: /usr/local/php80/php/man/man8/ Installing PHP FPM status page: /usr/local/php80/php/php/fpm/ Installing phpdbg binary: /usr/local/php80/bin/ Installing phpdbg man page: /usr/local/php80/php/man/man1/ Installing PHP CGI binary: /usr/local/php80/bin/ Installing PHP CGI man page: /usr/local/php80/php/man/man1/ Installing build environment: /usr/local/php80/lib/php/build/ Installing header files: /usr/local/php80/include/php/ Installing helper programs: /usr/local/php80/bin/ program: phpize program: php-config Installing man pages: /usr/local/php80/php/man/man1/ page: phpize.1 page: php-config.1 /home/fanjiapeng/php-8.0.0alpha1/build/shtool install -c ext/phar/phar.phar /usr/local/php80/bin/phar.phar ln -s -f phar.phar /usr/local/php80/bin/phar Installing PDO headers: /usr/local/php80/include/php/ext/pdo/
7. Verify PHP
/usr/local/php80/bin/php -v PHP 8.0.0alpha1 (cli) (built: Jul 2 2020 15:47:26) ( NTS DEBUG ) Copyright (c) The PHP Group Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
8. Environment configuration
ln -s /usr/local/php80/bin/php /usr/bin/php80 cp php.ini-development /usr/local/php80/etc/php.ini cp /usr/local/php80/etc/php-fpm.conf.default /usr/local/php80/etc/phpfpm.conf cp /usr/local/php80/etc/php-fpm.d/www.conf.default /usr/local/php80/etc/php-fpm.d/www.conf cp sapi/fpm/init.d.php-fpm /etc/init.d/php80-fp chmod +x /etc/init.d/php80-fpm
9. Verify configuration path
Verify whether the customized configuration items take effect: --with-config-file-path, --with-config-file-scan-dir
php80 --ini Configuration File (php.ini) Path: /usr/local/php80/etc/ Loaded Configuration File: /usr/local/php80/etc/php.ini Scan for additional .ini files in: /usr/local/php80/etc/php.d/ Additional .ini files parsed: (none)
10, Start FPM
/etc/init.d/php80-fpm start Starting php-fpm done
11. Verify FPM
ps aux | grep php-fpm root 26876 0.0 0.0 52084 2828 ? Ss Jul02 0:14 php-fpm: master process (/usr/local/php80/etc/php-fpm.conf) nobody 26877 0.0 0.0 52084 3648 ? S Jul02 0:00 php-fpm: pool www nobody 26878 0.0 0.0 52084 3624 ? S Jul02 0:00 php-fpm: pool www /etc/init.d/php80-fpm -h Usage: /etc/init.d/php80-fpm {start|stop|forcequit|restart|reload|status|configtest} /etc/init.d/php80-fpm status php-fpm (pid 26876) is running... /etc/init.d/php80-fpm configtest [06-Jul-2020 11:06:42] NOTICE: configuration file /usr/local/php80/etc/php fpm.conf test is successful
The Nginx configuration details are omitted here, mainly to quickly test whether the installed PHP-FPM mode is available of.
// index.php <?php var_dump(PHP_VERSION); var_dump(PHP_VERSION_ID);
curl localhost string(11) "8.0.0alpha1" int(80000)
12. Try new features JIT
Machine configuration: 8-core 16G, SATA disk, operating system: CentOS Linux release 7.4.1708 (Core)
Zend OPCache (/usr/local/php80/etc/php.ini) is configured as follows. Most of the [opcache] configuration items have default values. In order to highlight the importance of these configuration items, they are listed:
; 加载 Zend OPCache 扩展 zend_extension=opcache ; 启用 Zend OPCache opcache.enable=1 ; 启用 Zend OPCache,在 CLI 模式下 opcache.enable_cli=1 ; OPCache 共享内存存储大小,默认值 128 opcache.memory_consumption=128 ; interned string 内存大小,默认值 8 opcache.interned_strings_buffer=8 ; 缓存脚本文件数量的上限,默认值 10000 opcache.max_accelerated_files=10000 ; 10秒检查一次文件的更新,默认值 2s opcache.revalidate_freq=10 ; 删除所有 PHPDoc 注释,默认值 1,表示保留注释 opcache.save_comments=0
This is a virtual machine with idle resources. After repeatedly turning on JIT and turning off JIT many times, the test results show that there is almost no change in the result value. The test results did not specifically select the most beautiful data. In fact, there is no need. As shown in the figure below:
13. Summary
This is a general PHP source code compilation and installation method. Other PHP versions can be compiled The installation method is similar. In actual business applications, the configure options are much richer, and the class libraries that need to be installed will be more comprehensive. In this article, the new feature JIT of PHP 8 is tested. According to the test results of Zend/bench.php, it is still eye-catching. For an introduction to PHP 8 JIT, we recommend "PHP8 New Features JIT Usage Introduction".
Recommended article: "PHP8.0"
The above is the detailed content of PHP 8.0 source code compilation and installation and JIT early adopter. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The differences between php5 and php8 are in terms of performance, language structure, type system, error handling, asynchronous programming, standard library functions and security. Detailed introduction: 1. Performance improvement. Compared with PHP5, PHP8 has a huge improvement in performance. PHP8 introduces a JIT compiler, which can compile and optimize some high-frequency execution codes, thereby improving the running speed; 2. Improved language structure, PHP8 introduces some new language structures and functions. PHP8 supports named parameters, allowing developers to pass parameter names instead of parameter order, etc.

The steps to add mysql extension to php8 are: 1. Install the MySQL client library; 2. Install the development tools for PHP 8; 3. Download the MySQL extension source code; 4. Compile and install the MySQL extension; 5. Enable the MySQL extension; 6. Restart Just a web server.

This article will introduce to you how to install apache2.4 and how to configure php8.0. The article is accompanied by pictures and detailed steps. Let's take a look at how to install and configure apache2.4+php8.0~

PHP8 can use mysqli and PDO to connect to the database. Detailed introduction: 1. Use mysqli to connect to the database by passing in the database server name, user name, password and database name to connect. Then, use the `connect_error` attribute to check whether the connection is successful and output an error message if the connection fails. Finally, close the connection by calling the `close()` method; 2. Use PDO to connect to the database, and connect by passing in the database server name, password and database name, etc.

The methods of the php8 data type include converting strings to integers, converting integers to strings, converting strings to floating point numbers, converting floating point numbers to strings, converting arrays to strings, converting strings to arrays, and converting Boolean values to integers. Integer conversion to Boolean value and variable type determination and conversion. Detailed introduction: 1. Converting a string to an integer includes the intval() function and (int) forced type conversion; 2. Converting an integer to a string includes the strval() function and (string) forced type conversion; 3. Converting a string to a float Points and so on.

This article will take you through the JIT in PHP 8 and talk about how JIT participates in the interpretation process. I hope it will be helpful to everyone!

The improved performance of php8 includes: 1. Introduction of JIT compiler; 2. Optimization of function calls; 3. Improvement of garbage collection mechanism; 4. Improvement of type system; 5. New language features; 6. Optimized string processing; 7. Improve array processing; 8. Introduce a new memory management mechanism; 9. Optimize code generation. Detailed introduction: 1. The introduction of the JIT compiler. PHP8 introduces the JIT compiler, which is a dynamic compilation technology that can convert PHP code into machine code for more efficient execution; 2. Optimization of function calls, etc.

Unlock PHP8’s JIT technology: Optimize your code execution speed With the release of PHP8 at the end of 2020, one of the most exciting new features is the introduction of JIT (Just-in-Time) compiler technology. JIT technology can significantly improve the execution speed of PHP code, especially those code fragments with intensive calculations and loops. In this article, we will explore how to use PHP8's JIT technology to optimize code execution speed, while providing some specific code examples. 1. What is a JIT compiler? J
