CentOS7下编译安装PHP8

CentOS7下编译安装PHP8

下载&解压缩

1
2
3
4
5
wget https://downloads.php.net/~pollita/php-8.0.0alpha1.tar.gz

tar -zxvf php-8.0.0alpha1.tar.gz

cd php-8.0.0alpha1/

编译安装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
./configure --prefix=/usr/local/php/php8 \
--with-config-file-path=/usr/local/php/php8 \
--enable-mbstring \
--enable-ftp \
--enable-gd \
--enable-gd-jis-conv \
--enable-mysqlnd \
--enable-pdo \
--enable-sockets \
--enable-fpm \
--enable-xml \
--enable-soap \
--enable-pcntl \
--enable-cli \
--with-openssl \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-pear \
--with-zlib \
--with-iconv \
--with-curl \
;
  • 输出:
1
2
3
4
5
6
7
8
9
10
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

编译错误, 谷歌一下.

1
make && make install

配置

  • 复制配置文件:
1
cp php.ini-production /usr/local/php/php8/php.ini
  • 打开错误
1
2
# vim /usr/local/php/php8/php.ini
display_errors = On
  • 复制fpm的启动脚本:
1
cp ./sapi/fpm/init.d.php-fpm /usr/local/php/php8/bin/php-fpm-8
  • 增加执行权限
1
    
  • 设置软连接
1
2
3
4
# php-fpm
ln -s /usr/local/php/php8/bin/php-fpm-8 /etc/init.d/php-fpm-8
# php.ini
ln -s /usr/local/php/php8/etc/php.ini /etc/php/php8.ini
  • 修改php-fpm配置文件:
1
2
3
4
5
6
7
cd /usr/local/php/php8/etc
cp php-fpm.conf/default php-fpm.conf
vim php-fpm.conf
# 去掉 pid = run/php-fpm.pid 前面的分号
# 修改启动用户:
user=www-www
group=www-www

编译错误

No package 'oniguruma' found

    1. yum安装rpm包
1
2
3
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

备用下载

  • onigurumahttp://down.24kplus.com/linux/oniguruma/oniguruma-6.7.0-1.el7.x86_64.rpm
  • oniguruma-develhttp://down.24kplus.com/linux/oniguruma/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

参考

Powered by Hexo and Hexo-theme-hiker

Copyright © 2017 - 2023 Keep It Simple And Stupid All Rights Reserved.

访客数 : | 访问量 :