php

分类:software 日期:2021-02-17 作者:admin 浏览:60

编译安装

ubuntu18.04
php7.4.15
centos7

1.安装相关依赖

#ubuntu
sudo apt install build-essential libpcre3-dev zlib1g zlib1g-dev curl  libjpeg62-dev libxml2 libxml2-dev libfreetype6 libfreetype6-dev libpng16-16 libpng-dev libpnglite-dev libiconv-hook-dev libiconv-hook1 libssl-dev libcurl4-openssl-dev  php-gd libxslt1-dev libsqlite3-dev libonig-dev  -y

#centos
sudo yum install libxml2 libxml2-devel sqlite-devel bzip2 bzip2-devel zlib zlib-devel libjpeg libjpeg-devel libpng libpng-devel gd gd-devel libxslt libxslt-devel freetype freetype-devel openssl openssl-devel  oniguruma oniguruma-devel libcurl libcurl-devel ncurses curl -y #libiconv

2.编译安装

# 新建用户(可选)
# useradd -s /sbin/nologin -M www

# ubuntu
./configure \
--prefix=/usr/local/php7.4.15 \
--with-fpm-user=www \ 
--with-fpm-group=www \
--with-apxs2=/usr/local/apache2.4.33/bin/apxs \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-iconv \
--with-curl \
--with-xsl \
--with-xmlrpc \
--with-pdo-mysql \
--enable-short-tags \
--enable-sockets \
--enable-mbstring \
--enable-static \
--enable-gd \
--enable-ftp \
--enable-fpm \
--enable-xml

# centos
./configure \
--prefix=/usr/local/php7.4.15 \
--with-apxs2=/usr/local/apache2.4.46/bin/apxs \
--with-fpm-user=www \
--with-fpm-group=www \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-curl \
--with-xsl \
--with-bz2 \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-iconv-dir \
--with-bz2 \
--with-iconv \
--enable-short-tags \
--enable-sockets \
--enable-mbstring \
--enable-static \
--enable-ftp \
--enable-gd \
--enable-fpm

make && make install 

复制配置文件

cp php.ini-production /usr/local/php7.4.15/lib/php.ini

配置

#开启配置
cd /usr/local/php/etc
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default www.conf
vi php-fpm.d/www.conf.default www.conf

# 修改用户和组,默认为www,没有可以新建,我直接使用nginx

参考

评论 (暂无评论)

发表评论

昵称:  
邮箱:  
网址: