KyLin zabbix系统安装php8 + nginx(web端)
php官网: PHP: Downloads
1.安装nginx和依赖
#yum update
#yum -y install nginx*
#yum -y install libxml2-devel bzip2-devel libcurl-devel libpng-devel libjpeg-devel freetype-devel gmp-devel openldap-devel readline-devel libxslt-devel net-snmp-devel autoconf langpacks-zh_CN.noarch
#yum -y install libzip*
2.编译php8
#tar -zxvf php-8.3.13.tar.gz
#cd php-8.3.13/
#./configure --prefix=/usr/local/php8 --with-config-file-path=/usr/local/php8/etc --with-mysqli --with-zlib --with-curl --with-jpeg --with-freetype --with-openssl --with-zip --with-ldap=/usr/lib64/ --with-imap-ssl --with-ldap-sasl --enable-gd --enable-fpm --enable-xml --enable-session --enable-ftp --enable-pdo --enable-bcmath --enable-sockets --enable-mbstring --enable-tokenizer --enable-cli --with-gettext
#make -j8 && make install
3.安装拓展模板 gettext、ldap
#cd ext/
#cd gettext/
#/usr/local/php8/bin/phpize
#./configure --with-php-config=/usr/local/php8/bin/php-config
#make -j4 && make install
#cd ../ldap
#/usr/local/php8/bin/phpize
#./configure --with-php-config=/usr/local/php8/bin/php-config
#make -j4 && make install
4.添加系统环境
#ln -s /usr/local/php8/bin/php /usr/bin/php
#php -v
#cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
#chmod +x /etc/init.d/php-fpm
5.配置基础配置文件
#php -r "phpinfo();" | grep php.ini #查询ini文件存放位置,将ini文件复制到对应目录
#cp php.ini-development /usr/local/php8/etc/php.ini
#cd /usr/local/php8/
#vim ./etc/php.ini
post_max_size = 32M
max_execution_time = 300
max_input_time = 600
#cp ./etc/php-fpm.conf.default ./etc/php-fpm.conf
#cp ./etc/php-fpm.d/www.conf.default ./etc/php-fpm.d/www.conf
# systemctl daemon-reload
#systemctl enable --now nginx php-fpm.service
6.配置nginx
#mkdir /usr/share/nginx/html/zabbix
#cd
#tar -zxvf zabbix-7.0.5.tar.gz
#cp ./zabbix-7.0.5/ui/* /usr/share/nginx/html/zabbix/
#chmod 777 -R /usr/share/nginx/html/zabbix
7.nginx添加php配置
location / {
root html;
index index.html index.htm index.php;
}
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;
}
8.配置前端页面
9.修改目录权限为755
#chmod 755 -R /usr/share/nginx/html/zabbix