centos7编译安装php8.1
一 下载源码包
wget https://www.php.net/distributions/php-8.1.1.tar.gz
二 解压
三 安装依赖软件
yum install -y oniguruma-devel openssl-devel gcc gcc-c++ wget make libxml2 libxml2-devel openssl \ openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel \ bison autoconf sqlite-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libxslt-devel \ libxslt libzip-devel libtidy-devel libtidy gmp gmp-devel libmcrypt libmcrypt-devel readline \ readline-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses gdbm-devel db4-devel \ libXpm-devel libX11-devel gd-devel expat-devel xmlrpc-c xmlrpc-c-devel libmemcached-devel \ libsqlite3x-devel
四 安装
./configure \ --prefix=/usr/local/php8 \ --with-config-file-path=/usr/local/php8/etc \ --enable-fpm \ --enable-mysqlnd \ --with-fpm-user=www \ --with-fpm-group=www \ --with-curl \ --enable-gd \ --with-tidy \ --with-gettext \ --enable-intl \ --with-kerberos \ --with-libdir=lib64 \ --with-mysqli \ --enable-ftp \ --with-openssl \ --with-pdo-mysql \ --with-pdo-sqlite \ --with-pear \ --disable-fileinfo \ --with-xsl \ --with-zlib \ --with-bz2 \ --with-mhash \ --enable-bcmath \ --enable-mbregex \ --enable-mbstring \ --enable-opcache \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-sysvsem \ --enable-sysvshm \ --enable-xml \ --enable-calendar \ --enable-exif
make && make install
五 配置 环境变量
vim /etc/profile
PATH=$PATH:/usr/local/php8/bin
export PATH
加载环境变量
source /etc/profile
参考地址 https://www.jianshu.com/p/d050d613cf45 https://lyh-lyh.cn/?p=428