linux编译安装php8 支持jit

2021-07-03  本文已影响0人  Renew全栈工程师

1.先下载php8最新源码,并且解压

wget -c https://github.com/php/php-src/archive/refs/tags/php-8.0.8.tar.gz
tar -zxvf php-8.0.8.tar.gz
cd php-src-php-8.0.8/
./buildconf --force

2.安装php需要的依赖库

(ubuntu centos 基本上替换下 前面的apt即可,如果不行找下相对应库的命令安装即可)

sudo apt-get install -y pkg-config build-essential  \
    autoconf bison re2c libxml2-dev libsqlite3-dev libcurl4-gnutls-dev \
    libjpeg-dev libpng-dev libmcrypt-dev  libreadline6-dev libfreetype6-dev \
    libtidy-dev libtool valgrind openssl libssl-dev libzip-dev libwebp-dev \
    libxpm-dev

3.编译

./configure \
 --prefix=/usr/local/php \
 --with-config-file-path=/usr/local/php/etc \
 --enable-fpm \
 --with-fpm-user=www \
 --with-fpm-group=www \
 --enable-rpath \
 --enable-re2c-cgoto \
 --enable-gcc-global-regs \
 --enable-phpdbg \
 --with-valgrind \
 --enable-zts \
 --with-openssl \
 --with-zlib \
 --enable-bcmath \
 --enable-calendar \
 --with-curl \
 --enable-ftp \
 --enable-gd \
 --with-webp \
 --with-jpeg \
 --with-xpm \
 --with-freetype \
 --with-gettext \
 --with-mhash \
 --enable-intl \
 --with-ldap-sasl \
 --enable-mbstring \
 --with-mysqli=mysqlnd \
 --enable-pcntl \
 --with-pdo-mysql=mysqlnd \
 --enable-soap \
 --enable-sockets \
 --enable-sysvmsg \
 --enable-sysvsem \
 --enable-sysvshm \
 --with-tidy \
 --enable-zend-test \
 --with-zip \
 --enable-mysqlnd \
 --with-pear

输出下面内容则成功
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.

如果报错 No package 'oniguruma' found,点击查看处理办法

sudo make
// 加快编译速度可以用下面的
// make -j6
// 使用方法就是在-j后面加一个数字,比如 -j6,意为在编译文件的时候用6个线程进行编译.
sudo make install
上一篇下一篇

猜你喜欢

热点阅读