PHP8.0.8安装报错记录

2021-07-24  本文已影响0人  甚解_4703

PHP历史版本下载地址
我下的是看到的最新的版本:https://www.php.net/distributions/php-8.0.8.tar.gz。顺嘴说一句用迅雷下载很快。。。

Linux机器信息:

lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:        8.2.2004
Codename:       Core

uname -a
Linux js-gate 4.18.0-193.28.1.el8_2.x86_64 #1 SMP Thu Oct 22 00:20:22 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

基本上是按照这里英文的教程安装的,但是里面会有报错,-_-

中文教程里面有个--with-mysqli 参数错误,瀑布汗-_-


索性自己整理了一份完整的:

安装php

yum -y install libxml2-devel
yum -y install sqlite-devel

mkdir -p /opt/soft
cd /opt/soft
wget -c --no-check-certificate https://www.php.net/distributions/php-7.2.34.tar.gz
tar -zxvf php-7.2.34.tar.gz
cd php-7.2.34
./configure --enable-fpm --with-mysqli --with-config-file-path=/usr/local/php
make && make install

cp php.ini-development /usr/local/php/php.ini
cp /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
cp sapi/fpm/php-fpm /usr/local/bin
cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf

vim /usr/local/etc/php-fpm.conf
  `include=None/etc/php-fpm.d/*.conf`  => `include=etc/php-fpm.d/*.conf`

vim /usr/local/php/php.ini
  cgi.fix_pathinfo=0

vim /usr/local/etc/php-fpm.d/www.conf
  ; Unix user/group of processes
  ; Note: The user is mandatory. If the group is not set, the default user's group
  ;       will be used.
  user = www-data
  group = www-data


php -v
php --ini
php-fpm -v
php-fpm

问题:
/usr/local/bin/php-fpm              
[26-Jul-2021 19:22:54] ERROR: [pool www] cannot get uid for user 'www-data'
[26-Jul-2021 19:22:54] ERROR: FPM initialization failed

解决:
groupadd www-data
useradd -g www-data www-data

安装php-yaf

wget --no-check-certificate https://pecl.php.net/get/yaf-3.3.3.tgz
tar -zxvf yaf-3.3.3.tgz
cd yaf-3.3.3
phpize
./configure --with-php-config=/usr/local/bin/php-config
make && make install

#重启php-fmp
#查看php-fmp进程ID
ps -aux | grep php-fpm
root     2078375  0.0  0.1  64328  6404 ?        Ss   00:46   0:00 php-fpm: master process (/usr/local/etc/php-fpm.conf)
nobody   2078376  0.0  0.2  95528 10772 ?        S    00:46   0:00 php-fpm: pool www
nobody   2078377  0.0  0.2  95528 10772 ?        S    00:46   0:00 php-fpm: pool www
root     2087337  0.0  0.0  12108  1060 pts/9    S+   14:25   0:00 grep --color=auto php-fpm

#INT, TERM 立刻终止
#QUIT 平滑终止
#USR1 重新打开日志文件
#USR2 平滑重载所有worker进程并重新载入配置和二进制模块
#重启
kill -USR2 2078375  

@最后注意: nginx配置改一下

nginx版本:

nginx -v
nginx version: nginx/1.17.10

修改nginx.conf

location ~ \.php$ {#这里把不区分大小写匹配改成区分大小写
            root           html;
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            #fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            fastcgi_param   SCRIPT_FILENAME    $document_root$fastcgi_script_name;#这里改一下
            include        fastcgi_params;
}

再运行就OK了

访问PHP主页 yaf支持

安装php-redis

wget --no-check-certificate https://pecl.php.net/get/redis-5.3.4.tgz
tar -zxvf redis-5.3.4.tgz
cd redis-5.3.4
phpize
./configure --with-php-config=/usr/local/bin/php-config
make && make install

安装php-mcrypt

wget --no-check-certificate https://pecl.php.net/get/mcrypt-1.0.4.tgz
tar -zxvf mcrypt-1.0.4.tgz
cd mcrypt-1.0.4
phpize
./configure --with-php-config=/usr/local/bin/php-config
make && make install

弄半天,其实还是用宝塔装起来快,还省事省力-_-!!!

上一篇 下一篇

猜你喜欢

热点阅读