ubuntu 编译安装 php8.1
下载 php 源代码文件
php8.1 下载地址安装必要的库文件
sudo apt-get install -y gcc make openssl curl libbz2-dev libxml2-dev libjpeg-dev libpng-dev libfreetype6-dev libzip-dev libssl-dev libsqlite3-dev libcurl4-openssl-dev libgmp3-dev libonig-dev libreadline-dev libxslt1-dev libffi-dev libpnglite-dev libpcre3-dev libiconv-hook-dev libiconv-hook1 libmcrypt-dev libmcrypt4 libmhash-dev libmhash2 libltdl-dev libssl-dev libcurl4-openssl-dev libmysqlclient-dev libmagickcore-dev libmagickwand-dev libedit-dev autoconf automake m4
预编译
./configure \ --prefix=/usr/local/php \ --enable-fpm \ --disable-debug \ --disable-rpath \ --enable-shared \ --with-mhash \ --with-sqlite3 \ --with-zlib \ --enable-bcmath \ --with-iconv \ --with-bz2 \ --with-openssl \ --enable-calendar \ --with-curl \ --with-cdb \ --enable-dom \ --enable-exif \ --enable-fileinfo \ --enable-filter \ --with-openssl-dir \ --with-zlib-dir \ --enable-gd-jis-conv \ --with-gettext \ --with-gmp \ --with-mhash \ --enable-mbstring \ --enable-mbregex \ --enable-pdo \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-pdo-sqlite \ --with-readline \ --enable-session \ --enable-shmop \ --enable-simplexml \ --enable-sockets \ --enable-sysvmsg \ --enable-sysvsem \ --enable-sysvshm \ --with-xsl \ --enable-mysqlnd-compression-support \ --with-pear \ --enable-opcache \ --with-zip \ --with-ffi
编译安装
make -j && make install
复制配置文件
cp php.ini-development /usr/local/php/lib/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
至此,php8.1 已经安装好了