码迷,mamicode.com
首页 > Web开发 > 详细

centos7源码编译安装LNMP+ZABBIX4.0LTS(3)——php

时间:2020-10-24 09:55:38      阅读:34      评论:0      收藏:0      [点我收藏+]

标签:安装php   php   mct   soap   lib   bsp   libjpeg   scan   class   

  • 环境:
    192.168.117.132——zabbix server
    192.168.117.133——zabbix proxy
  • 安装路径为/zabbix
  • 安装php

 

1.安装包下载

https://www.php.net/downloads.php

本次使用稳定版7.2.34

技术图片

 

 

2.安装依赖

yum install -y gcc gcc-c++ freetype-devel libpng-devel libjpeg-devel libxml2-devel bzip2-devel libcurl-devel

 

3.创建目录

mkdir /zabbix/php

 

4.编译安装

tar -xf php-7.2.34.tar.gz
cd php-7.2.34

./configure --prefix=/zabbix/php --with-config-file-path=/zabbix/php/etc --with-pdo-mysql=/zabbix/mysql/mysql --with-mysqli=/zabbix/mysql/mysql/bin/mysql_config --with-mysql-sock=/zabbix/mysql/logs/mysql.sock --with-gd --with-iconv --with-libxml-dir --with-mhash --with-config-file-scan-dir=/zabbix/php/etc/ini.d --with-bz2 --with-zlib --with-freetype-dir --with-png-dir --with-jpeg-dir --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp  --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-curl

make -j4 && make install

 

5.修改配置

cp /root/php-7.2.34/php.ini-production /zabbix/php/etc/php.ini
cp /root/php-7.2.34/sapi/fpm/php-fpm.service  /usr/lib/systemd/system/php-fpm.service
cp /zabbix/php/etc/{php-fpm.conf.default,php-fpm.conf}
cp /zabbix/php/etc/php-fpm.d/www.conf{.default,}

#修改配置文件
sed -i "s/listen = 127.0.0.1:9000/listen = 0.0.0.0:9000/g; s/pm.max_children = 5/pm.max_children = 50/g; s/pm.start_servers = 2/pm.start_servers = 5/g; s/pm.min_spare_servers = 1/pm.min_spare_servers = 5/g; s/pm.max_spare_servers = 3/pm.max_spare_servers = 35/g" /zabbix/php/etc/php-fpm.d/www.conf

sed -i "s/upload_max_filesize = 2M/upload_max_filesize = 50M/g; s/;date.timezone =/date.timezone =PRC/; s/max_execution_time = 30/max_execution_time = 600/g; s/max_input_time = 60/max_input_time = 600/g; s/memory_limit = 128M/memory_limit = 256M/g; s/post_max_size = 8M/post_max_size = 16M/g" /zabbix/php/etc/php.ini

 

6.启动

systemctl start php-fpm

#添加开机启动
systemctl enable php-fpm

 

7.添加页面访问测试

cat > /zabbix/nginx/html/zabbix/index.php << EOF
<?php
         phpinfo();
?>
EOF

浏览器输入ip/index.php

 技术图片

 

 

 

至此,php安装完成,lnmp环境已经准备好

 

centos7源码编译安装LNMP+ZABBIX4.0LTS(3)——php

标签:安装php   php   mct   soap   lib   bsp   libjpeg   scan   class   

原文地址:https://www.cnblogs.com/old-path-white-cloud/p/13861833.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!