php7.4安装

1.首先安装依赖

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libzip-devel pcre-devel

2.下载php7.4压缩包

https://www.php.net/distributions/php-7.4.0.tar.gz

3.解压压缩包,cd进入解压后的目录

        4./configure 配置参数

./configure --prefix=/usr/local/php --with-config-file-path=/etc --with-curl --with-freetype-dir --enable-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-fpm

./configure时出现的错误
(1)缺少sqlite3

解决方法:

yum -y install sqlite-devel

(2)缺少oniguruma

解决方法:

yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm

备用下载:

yum install http://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
yum install http://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm
04058

(3)缺少bzip2

error:Please reinstall the BZip2 distribution

解决办法:

yum install bzip2 bzip2-devel

(4)缺少libxslt

configure: error: Package requirements (libxslt >= 1.1.0) were not met:
No package 'libxslt' found

解决办法:

yum install libxslt-devel

5.安装

make && make install

执行完安装命令后php7.4就已经安装在到了/usr/local/php目录下了

6.查看版本

/usr/local/php/bin/php -v

7.添加环境变量

vim /etc/profile

添加到最后

PATH=$PATH:/usr/local/php/bin
export PATH

更新环境变量

source /etc/profile

查看版本

php -v

8.配置php-fpm

cp php.ini-production /etc/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
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

配置文件php.ini位置:/etc/php.ini

9.启动php-fpm

/etc/init.d/php-fpm start

或者

service php-fpm start

你可能感兴趣的:(linux,centos,php,sqlite)