CentOS Stream 9安装PHP8.2


安装remi源

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
dnf install https://rpms.remirepo.net/enterprise/remi-release-9.rpm

查看可以安装的PHP版本

dnf module list php
Remi's Modular repository for Enterprise Linux 9 - x86_64
Name      Stream        Profiles                        Summary                    
php       remi-7.4      common [d], devel, minimal      PHP scripting language     
php       remi-8.0      common [d], devel, minimal      PHP scripting language     
php       remi-8.1      common [d], devel, minimal      PHP scripting language     
php       remi-8.2      common [d], devel, minimal      PHP scripting language     

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

启用PHP8.2版本

dnf module enable php:remi-8.2

安装PHP扩展

dnf install php-fpm php php-bcmath php-cli php-common php-gd php-imap php-mbstring php-mcrypt php-mysql php-mysqlnd php-pdo php-soap php-tidy php-xml php-xmlrpc php-opcache php-redis php-pecl-mcrypt -y

查看PHP版本

php -v
PHP 8.2.2 (cli) (built: Jan 31 2023 13:31:55) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.2, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.2, Copyright (c), by Zend Technologies

开启jit功能

cd /etc/php.d/

编辑扩展文件,在文件最后添加jit配置

vim 10-opcache.ini
opcache.jit_buffer_size=256M
opcache.jit=1255

重启PHP

systemctl restart php-fpm

查看jit是否开启成功

php -i|grep 'opcache.jit'
opcache.jit => 1255 => 1255
opcache.jit_bisect_limit => 0 => 0
opcache.jit_blacklist_root_trace => 16 => 16
opcache.jit_blacklist_side_trace => 8 => 8
opcache.jit_buffer_size => 256M => 256M
opcache.jit_debug => 0 => 0
opcache.jit_hot_func => 127 => 127
opcache.jit_hot_loop => 64 => 64
opcache.jit_hot_return => 8 => 8
opcache.jit_hot_side_exit => 8 => 8
opcache.jit_max_exit_counters => 8192 => 8192
opcache.jit_max_loop_unrolls => 8 => 8
opcache.jit_max_polymorphic_calls => 2 => 2
opcache.jit_max_recursive_calls => 2 => 2
opcache.jit_max_recursive_returns => 2 => 2
opcache.jit_max_root_traces => 1024 => 1024
opcache.jit_max_side_traces => 128 => 128
opcache.jit_prof_threshold => 0.005 => 0.005

设置PHP开机自启

systemctl enable php-fpm