Zabbix源码安装教程-安装并配置php

安装并配置php的步骤。包括解压php-7.2.17.tar.gz,安装依赖包,拷贝服务和配置文件,更改php文件加的拥有者和修改php.ini配置文件等。
六、安装并配置php

(1)  解压php-7.2.17.tar.gz

  
#tar -xvf php-7.2.17.tar.gz && cd  php-7.2.17
  


(2)  安装依赖包

  
#yum install -y libxml2-devel  openssl-devel net-snmp net-snmp-devel libcurl-devel libjpeg-devel  libpng-devel libicu-devel openldap-devel bzip2 bzip2-devel freetype-devel  gmp-devel readline-devel libxslt-devel fontconfig
  
#./configure --prefix=/mnt/hg/php-7.2.17  --with-mysqli=/mnt/hg/mysql-last/bin/mysql_config --enable-inline-optimization  --enable-fpm --enable-soap --enable-pcntl --enable-xml --with-libxml-dir  --with-xmlrpc --with-openssl --with-mhash --with-pcre-regex --with-sqlite3  --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar  --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo  --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir  --with-jpeg-dir --with-png-dir --with-freetype-dir --with-gettext --with-gmp  --with-mhash --enable-json --enable-mbstring --disable-mbregex  --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo  --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline  --enable-session --enable-shmop --enable-simplexml --enable-sockets  --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx  --with-libxml-dir --with-xsl --enable-zip  --enable-mysqlnd-compression-support --with-pear --without-pear
#make -j4
#make install

(3)  拷贝服务和配置文件

  
#cd ~/zabbix/php-7.2.17
  
#cp sapi/fpm/php-fpm.service  /usr/lib/systemd/system/php-fpm.service
#cp  /mnt/hg/php-7.2.17/etc/{php-fpm.conf.default,php-fpm.conf}
#cp  /mnt/hg/php-7.2.17/etc/php-fpm.d/www.conf{.default,}
#cp  php.ini-production /mnt/hg/php-7.2.17/lib/php.ini


(4)  更改php-7.2.17文件夹的拥有者和拥有组

  
#cd  /mnt/hg
  
#chown  nginx:nginx -R php-7.2.17

(5)  修改php.ini配置文件

vim /mnt/hg/php-last/lib/php.ini
  
post_max_size  = 16M
  
max_execution_time  = 300
  
max_input_time  = 300
  
date.timezone  = PRC
  

(6)  启动PHP

  

#systemctl  start php-fpm.service && systemctl enable php-fpm.service
  zTMn00Ty62d509efe4724.jpg

(7)  编辑nginx.conf配置文件,使nginx支持PHP

vim/mnt/hg/nginx-last/conf/nginx.conf
  
location  ~ "\.php$" {
  
root    /mnt/hg/nginx-last/html/;
  
    fastcgi_pass 127.0.0.1:9000;
  
    fastcgi_index index.php;
  
    fastcgi_param SCRIPT_FILENAME  /mnt/hg/nginx-last/html$fastcgi_script_name;
  
    include fastcgi_params;
  
}
  

(8)  测试PHP效果① 编写测试页面

vim /mnt/hg/nginx-last/html/index.php
  
<?php
  
         phpinfo();
  
?>
  

② 重新加载nginx配置,测试index.php页面

  

#nginx  -s reload
  tBeJR9m462d50a153cd44.jpg

0 条评论

请先 登录 后评论
乐维君
乐维君

345 篇文章

作家榜 »

  1. 乐维君 345 文章
  2. YOHOHO 14 文章
  3. 机灵小和尚 13 文章
  4. 我是一只小菜鸡 12 文章
  5. 细雨闲花 11 文章
  6. 御前侍卫张五哥 9 文章
  7. 。。。 8 文章
  8. 小黄人 8 文章