【原】CentOS7安装PHP8
in with 0 comment

【原】CentOS7安装PHP8

in with 0 comment

常用的LANMP一键安装包有Oneinstack和LNMP一键安装包,如果遇到新版本的安装问题可以参照一键安装包脚本

安装各必要组件

yum -y install make pcre-devel cmake gcc gcc-c++ flex bison libaio file libtool libtool-libs autoconf kernel-devel patch wget libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl libjpeg libjpeg-devel libpng libpng-devel curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel aspell-devel libcap diffutils net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel libicu-devel freetype-devel libxslt libxslt-devel sqlite-devel

编译安装libzip

wget https://nih.at/libzip/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure --libdir=/lib64
make
make install

编译安装oniguruma

./configure --prefix=/usr --libdir=/lib64
make
make install

编译安装PHP8

./configure --prefix=/opt/php8 --with-config-file-scan-dir=/etc/php8/php.d --with-config-file-path=/etc/php8 --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl --with-xsl --with-zlib --with-zip -with-bz2 --with-iconv --enable-fpm --enable-pdo --enable-bcmath --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-cli --enable-opcache --enable-intl --enable-calendar --enable-static --enable-mysqlnd --with-fpm-user=www --with-fpm-group=www
make
make install

* 安装完记得将php.ini移动到指定目录
* 安装完记得修改php-fpm的配置文件
* 安装完记得启动php-fpm

编译安装Tengine

./configure --prefix=/opt/nginx --user=www --group=www --with-http_mp4_module --with-http_flv_module --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-http_realip_module --with-stream=dynamic --with-stream_ssl_module --with-stream_realip_module --with-stream_geoip_module=dynamic
location ~ \.php$ {            
    root           html;           
    fastcgi_pass   127.0.0.1:9000;            
    fastcgi_index  index.php;            
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;           
    include        fastcgi_params;
}

安装MySQL(centos)这里使用Yum安装。

** 当前示例只支持64位系统,别的系统的rpm包请去MySQL官网获取
wget http://mirrors.ustc.edu.cn/mysql-repo/mysql80-community-release-el7-1.noarch.rpm
rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
// 找出maria相关的包
rpm -qa | grep mariadb

// 移除上面找出的mariadb的包
yum erase -y mariadb*

// 最后在检查下还有没有mariadb
rpm -qa | grep mariadb
// 禁用MySQL模块
yum module disable mysql

// 如果出现下载速度慢,可以杀掉进程,重新install,会快很多
yum install mysql-community-server
systemctl start mysqld.service
# 查看默认密码
grep 'temporary password' /var/log/mysqld.log
# 修改默认密码,先登录再修改
mysql -uroot -p

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
systemctl enable mysqld.service

判断是否编译完成

需要注意的

Comments are closed.