月度归档: 2022 年 5 月

  • PHP7.4 升级到 PHP8.1

    由于 php7.4 马上结束维护了,所以把博客服务器 PHP 版本做了个升级,直接升级到当前的最新稳定版 PHP8.1。

    升级,直接安装PHP8.1 即可。

    PHP8.1 的安装命令如下:

    apt install php8.1-fpm php8.1-mysql php8.1-mbstring php8.1-curl php8.1-xml php8.1-imagick php8.1-zip php8.1-gd php8.1-intl php8.1-bcmath

    安装完成后,顺便开启了 PHP8.1 的 JIT,以提高性能,开启方法如下:

    编辑 php.ini,在 opcache 配置部分添加加粗的两行:

    [opcache]
    ; Determines if Zend OPCache is enabled
    opcache.enable=1
    opcache.jit=tracing
    opcache.jit_buffer_size=50M

    保存后记得重启 php8.1-fpm。

    参考链接:https://stitcher.io/blog/php-8-jit-setup