zabbix编译php_Zabbix4.X(三)之编译安装php 7.3.7

1.解决依赖包

命令:

yum -y install libicu-devel libxslt-devel

e176eebede39152c851a2b4c5addfd73.png

2.解决编译出现错误:configure: error: Cannot find ldap libraries in /usr/lib

操作:cp -frp /usr/lib64/libldap* /usr/lib/

a7968015e01d28744a1115795747c09c.png

3.php 7.3.7需要libzip的版本在1.2.0及以上,重新编译安装libzip

命令:

yum remove -y libzip

cd /usr/local/src

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

make && make install

3bd5a8dfb4e4a5f23373ab82725cabe8.png

2378f0beb52dacbb27f348a33ebea7ca.png

4.解决编译出现报错:php安装执行configure报错error: off_t undefined; check your library configuration

vim /etc/ld.so.conf

#添加如下几行

/usr/local/lib64

/usr/local/lib

/usr/lib

/usr/lib64

#保存退出

:wq

82966d0499fd995a0e3ceb14dfe65f77.png

ldconfig -v # 使之生效

6b8cb781f9d363ef7583d64821c84aa4.png

5.解决编译出现报错:安装php7.3.7 解决报错 /usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or dire

命令:

cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h

69013f8e5549eed405f2aa0736ff9e49.png

6.下载php7.37到/usr/local/src目录,或者直接下载再上传到/usr/local/src也行

命令:

cd /usr/local/src

wget https://www.php.net/distributions/php-7.3.7.tar.gz #下载比较慢,建议直接下载上传

b0bc7af94dea840a04f85bfc3350065a.png

7.预编译php7.3.7

命令:

cd php7.3.7

./configure --prefix=/usr/local/php \

--with-config-file-path=/usr/local/php/etc --enable-mysqlnd \

--with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \

--enable-mysqlnd-compression-support --with-iconv-dir \

--with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib \

--with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath \

--enable-shmop --enable-sysvsem --enable-inline-optimization \

--with-curl --enable-mbregex --enable-mbstring --enable-intl \

--with-gd --enable-gd-jis-conv --with-openssl \

--with-mhash --enable-pcntl --enable-sockets --with-xmlrpc \

--enable-zip --enable-soap --with-gettext --disable-fileinfo \

--enable-opcache --with-pear --enable-maintainer-zts \

--with-ldap=shared --without-gdbm --enable-fpm

33ee96e7f526c9b43168cbd2669114fc.png

8.编译安装php

命令:make &&make install

2aeb484395f2d96a9b337e8c52e1f410.png

9.复制php.ini

命令:cp php.ini-production /usr/local/php/etc/php.ini

62d8fa6155dd3d688f8c8d44b3418e01.png

10.复制配置文件php-fpm.conf

命令:mv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

f7eb9d43e2312af451ded63a8178914a.png

11.复制

命令:

cd /usr/local/php/etc/php-fpm.d/

mv www.conf.default www.conf

6226ee59f0b7132dd2ced24765ab4d01.png

12.添加环境变量

命令:

vi /etc/profile.d/php-fpm.sh

export PATH=$PATH:/usr/local/php/sbin/:/usr/local/php/bin/

93f1bd87fe948bc55980bdd3e2c9e5df.png

重启环境变量让其立即生效

40784f5b6697f92a22fe0f2aa0d923a6.png

13.检查配置文件是否有误

命令:

php-fpm -t

9ca3ec00f055d5c04692f61ec0d0996e.png

14.添加systemctl脚本启动文件

命令:

vi /usr/lib/systemd/system/php-rpm.service

[Unit]

Description=php-fpm

After=network.target

[Service]

Type=forking

ExecStart=/usr/local/php/sbin/php-fpm

[Install]

WantedBy=multi-user.target

ca89023f2c65b0b39d118401e38e4f39.png

15.添加开机自启,启动php-fpm服务

命令:

systemctl enable php-fpm

systemctl start php-fpm

cfe3ba47ea5042e259e2b005c16814ad.png

16.查看php-fpm进程

命令:

ps aux | grep php-fpm

dde85f5b6c82f48dbfc4f1452973a810.png

17.验证php文件是否正常访问

在nginx的html目录下创建一个test.php文件,并输入如下内容

echo "zabbix 4.X";

?>

94a9883322f4b28e86ed257aeb0995ba.png

配置nginx的配置文件nginx.conf,找到location /下添加index.php

命令:

vi /usr/local/nginx/conf/nginx.conf

80b76c4c701c7e131419f5e534e2619e.png

启用fastcgi,默认是被注释掉,并把/scripts$fastcgi_script_name修改为$document_root$fastcgi_script_name

b0723a6f554268348e13430951b25355.png

重启下nginx进程

命令:

systemctl restart nginx

ebca832cd8109d85b3caf39607a5b551.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值