1、安装mysql5.7
2、安装nginx
主配置文件:
[bjxtb@xm-itop-113-166 ~]$ cat /etc/nginx/nginx.conf
user bjxtb;
worker_processes auto;
worker_rlimit_nofile 60000;
error_log /hskj/logs/nginx/nginx-error.log;
events {
use epoll;
worker_connections 50000;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /hskj/logs/nginx/nginx-access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 1000;
server_tokens off;
#gzip on;
include conf.d/*.conf;
}
include conf.d/*.tcp;
#iTop配置文件
[bjxtb@xm-itop-113-166 ~]$ cat /etc/nginx/conf.d/itop.conf
server {
listen 80;
server_name 192.168.113.166;
root /hskj/iTop;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
location ~ ^(.+.\.php)(/|$) {
#include snippets/fastcgi-php.conf;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
3、安装php
在CentOS 7.9上安装PHP 8.1.28,可以通过多种方法实现,包括使用RPM仓库安装
安装EPEL和Remi仓库
Remi的RPM仓库提供了CentOS 7上PHP 8.1的安装包。首先,你需要安装EPEL仓库(如果尚未安装),然后安装Remi的RPM仓库。
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y https://rpms.remirepo.net/enterprise/remi-release-7.rpm
启用Remi的PHP 8.1仓库
使用yum-config-manager命令启用Remi的PHP 8.1仓库。如果系统中没有yum-config-manager命令,你可能需要先安装yum-utils。
sudo yum install -y yum-utils
sudo yum-config-manager --enable remi-php81
注意:这里假设Remi仓库已经包含了PHP 8.1.28的版本。如果仓库中没有这个版本,你可能需要选择最接近的版本或等待仓库更新。
安装PHP 8.1及其扩展
现在,你可以使用yum命令安装PHP 8.1及其所需的扩展。
sudo yum install php php-cli php-fpm php-json php-common php-mysqlnd php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-soap
这个命令安装了PHP 8.1的核心包和一些常用的扩展。你可以根据需要添加其他扩展。
验证安装
使用php -v命令检查PHP的版本,以确保安装成功。
启动服务
systemctl enable --now php-fpm
修配php-fpm.conf配置文件。
[root@xm-itop-113-166 ]# cat /etc/php-fpm.d/www.conf
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[bjxtb] #修改成和/hskj/iTop目录用户的权限
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or @php_fpm_prefix@) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache user chosen to provide access to the same directories as httpd
user = bjxtb #修改成和/hskj/iTop目录用户的权限
; RPM: Keep a group allowed to write in log dir.
group = bjxtb #修改成和/hskj/iTop目录用户的权限
......
用户权限错误:
file_put_contents(/hskj/iTop/data/setup/authent): Failed to open stream: Per