龙空技术网

PHP编译安装方法(为搭建zabbix系统)

知行0IT 66

前言:

当前我们对“php怎么编译”都比较看重,咱们都需要了解一些“php怎么编译”的相关文章。那么小编同时在网摘上搜集了一些有关“php怎么编译””的相关知识,希望我们能喜欢,看官们快快来学习一下吧!

Zabbix学习笔记(三)- PHP编译安装方法(为搭建zabbix系统)

1、 环境介绍

操作系统:Centos7.3 Linux

版本:PHP5.6.34

镜像源:阿里镜像源

2、 安装依赖包

yum -y install gcc gcc-c++ make pcre pcre-devel zlib zlib-devel openssl openssl-devel libxml2 libxml2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel openldap openldap-devel libmcrypt libmcrypt-devel

3、 编译安装

tar zxf php-5.6.34.tar.gz

cd php-5.6.34

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-ctype --with-mysql=mysqlnd --with-mysqli=mysqlnd --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 --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --with-gettext --enable-fpm

make

make install

cp php.ini-production /usr/local/php/etc/php.ini

4、 使用systemctl管理php-fpm:

目录创建:

mkdir –p /usr/lib/system/system/

/usr/lib/system/system/php-fpm.service

[Unit]

Description=php-fpm

After=network.target#网络启动以后启动

[Service]

Type=forking

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

[Install]

WantedBy=multi-user.target

5、 启动

环境变量:

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

生成配置文件:

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

启动:

php-fpm –t检查

systemctl start php-fpm或者php-fpm

netstat -lntup|grep php

6、 文件目录

目录/usr/local/php/:

lib var sbin php include bin etc

Zabbix系列请看下集-MySQL数据库的安装

标签: #php怎么编译