Centos8编译安装 php8
centos8 安装php8
1.下载软件
wget http://www.ijg.org/files/jpegsrc.v9d.tar.gz wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.37.tar.gz?download wget http://mirrors.nju.edu.cn/gnu/libiconv/libiconv-1.16.tar.gz
2.安装 扩展库
2.1
tar zxvf jpegsrc.v9d.tar.gz cd jpeg-9d/ ./configure --prefix=/usr/local/lib/jpeg --enable-shared --enable-static make make install cd ../
2.2
tar zxvf libpng-1.6.37.tar.gz cd libpng-1.6.37 ./configure --prefix=/usr/local/lib/libpng make make install cd ../
2.1
tar zxvf libiconv-1.16.tar.gz
cd libiconv-1.16/
./configure --prefix=/usr/local/lib/libiconv
make
make install
cd ../
vi /etc/ld.so.conf.d/my.conf
添加yihang:
/usr/local/lib
/usr/local/lib/lib
然后:
ldconfig
tar zxvf libxml2-2.9.10.tar.gz
cd libxml2-2.9.10/
./configure
make
make install
cd ../
yum install gcc gcc-c++ autoconf zlib zlib-devel glibc glibc-devel libpng libpng-devel libjpeg-turbo libjpeg-turbo-devel freetype freetype-devel xz gd libmcrypt mhash libxml2 libxml2-devel glib2 glib2-devel bzip2 bzip2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel libidn openssl openssl-devel
yum install sqlite-devel libcurl-devel oniguruma libzip libzip-devel
tar xvzf sqlite-autoconf-3071502.tar.gz
cd sqlite-autoconf-3071502
./configure --prefix=/usr/local
make
make install
https://github.com/kkos/oniguruma
./configure
./configure --prefix=/usr --libdir=/lib64
make
sudo make install
3.安装php
cd php-8.0.3
export LIBS="-lm -lresolv"
export DYLD_LIBRARY_PATH="/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64:/usr/libexec/"n
export LD_LIBRARY_PATH="/lib/:/usr/lib/:/usr/local/lib:/lib64/:/usr/lib64/:/usr/local/lib64:/usr/libexec/"
./configure \
--prefix=/usr/local/service/php8.0.3 \
--with-config-file-path=/usr/local/service/php8.0.3/etc \
--with-mysqli=shared,mysqlnd \
--with-pdo-mysql=shared,mysqlnd \
--enable-opcache \
--with-iconv=/usr/local/lib/libiconv \
--with-freetype \
--with-jpeg \
--with-libxml \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--enable-gd \
--with-zip \
--enable-soap \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql-sock=/data/mysql/mysql.sock \
--disable-rpath \ (使用后,不会搜索附加的动态链接库,会造成opcache编译不过)
--with-xmlrpc \ XML-RPC是Userland Software公司设计的一种格式:是一种使用HTTP协议传输XML格式文件来获取远程程序调用(Remote Procedure Call)的传输方式。官方网站是www.xmlrpc.com。
--enable-maintainer-zts \ pthreads多线程扩展需要开启zts
make
make install
echo -e '\nexport PATH=/usr/local/service/php8.0.3/bin:/usr/local/service/php8.0.3/sbin:$PATH\n' >> /etc/profile && source /etc/profile
4.配置文件
5. 安装扩展
ImageMagick是一套功能强大、稳定而且免费的工具集和开发包,可以用来读、写和处理超过89种基本格式的图片文件
yum -y install perl-CPAN ImageMagick
tar zxvf ImageMagick-7.0.7-28.tar.gz
cd ImageMagick-7.0.7-28
./configure
make
make install
cd ../
tar zxvf imagick-3.4.3.tgz
cd imagick-3.4.3
/usr/local/service/php8.0.3/bin/phpize
./configure --with-php-config=/usr/local/service/php8.0.3/bin/php-config
make
make install
cd ../
5.2 redis
wget https://download.redis.io/releases/redis-6.2.1.tar.gz
make
make PREFIX=/usr/local/service/redis install
cd ../
mkdir -p /data/redis/6379/
配置文件:redis.conf
启动:
/usr/local/service/redis/bin/redis-server /data/redis/6379/redis.conf & 2&1 > /data/redis/6379/redis.log
redis.so
https://github.com/phpredis/phpredis/archive/5.3.3.tar.gz
tar zxvf 5.3.3.tar.gz
cd phpredis-5.3.3/
/usr/local/service/php8.0.3/bin/phpize
./configure --with-php-config=/usr/local/service/php8.0.3/bin/php-config
make
make install
cd ..
swoole
wget https://github.com/swoole/swoole-src/archive/v4.6.3.tar.gz
tar zxvf v4.6.3.tar.gz
cd swoole-src-4.6.3
/usr/local/service/php8.0.3/bin/phpize
./configure --with-php-config=/usr/local/service/php8.0.3/bin/php-config --enable-swoole-json
make
make install
cd ..