博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos下的php编译安装
阅读量:7144 次
发布时间:2019-06-29

本文共 4149 字,大约阅读时间需要 13 分钟。

  hot3.png

准备

  1. 下载: 下载 的文件

  2. 系统环境 根据需要的基本功能模块,需要准备以下软件

    后yum更新

    yum -y install autoconf automake libtool gcc gcc-c++ openssl openssl-devel

    处理xml相关需要libxml2库

    处理url相关需要curl库

    处理图像相关需要freetype库

    处理图像相关需要libjpeg库

    处理图像相关需要libpng库

    处理图像相关需要gd库

    处理mcrypt需要 libmcrypt

安装

  1. install libxml
tar xzf libxml2-2.7.2.tar.gz    cd libxml2-2.7.2    ./configure    make && make install
  1. install freetype
tar xzf freetype-2.6.2.tar.gz    cd freetype-2.6.2    ./configure    make && make install
  1. install libjpeg
tar xzf jpegsrc.v9a.tar.gz    cd jpeg-9a    ./configure --enable-shared --enable-static    make && make install
  1. install zlib
tar xzf zlib-1.2.8.tar.gz    cd zlib-1.2.8    ./configure    make && make install
  1. iinstall libpng
tar xzf libpng-1.6.12.tar.gz    cd libpng-1.6.12    ./configure    make && make install
  1. install libgd
tar xzf gd-2.0.35.tar.gz    cd gd-2.0.35    ./configure --enable-shared    make && make install
  1. install curl
tar xzf curl-7.37.1.tar.gz    cd curl-7.37.1    ./configure    make && make install
  1. install Libmcrypt
tar xzf libmcrypt-2.5.8.tar.gz    cd libmcrypt-2.5.8    ./configure    make && make install
  1. install php
tar xzf php-5.5.30.tar.gz    cd php-5.5.30    ./configure --enable-ctype --enable-exif --enable-ftp --with-curl --with-zlib --with-mysql-sock=/tmp/mysql.sock --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-mbstring --disable-debug --enable-sockets --disable-short-tags --enable-phar --enable-fpm --with-gd --with-openssl --with-mysql --with-mcrypt --enable-bcmath --with-iconv --enable-pcntl --enable-zip --enable-soap --enable-session --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-freetype-dir=/usr/local    make && make install
cp php.ini-development /etc/php.inicp php-fpm.conf.default /usr/local/etc/php-fpm.conf

使用

1.设置为服务 保存以下代码到/etc/init.d/php-fpm

#! /bin/sh### BEGIN INIT INFO# Provides:          php-fpm# Required-Start:    $remote_fs $network# Required-Stop:     $remote_fs $network# Default-Start:     2 3 4 5# Default-Stop:      0 1 6# Short-Description: starts php-fpm# Description:       starts the PHP FastCGI Process Manager daemon### END INIT INFOprefix=/usr/localexec_prefix=${prefix}php_fpm_BIN=${exec_prefix}/sbin/php-fpmphp_fpm_CONF=${prefix}/etc/php-fpm.confphp_fpm_PID=/tmp/php-fpm.pidphp_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"wait_for_pid () {	try=0	while test $try -lt 35 ; do		case "$1" in			'created')			if [ -f "$2" ] ; then				try=''				break			fi			;;			'removed')			if [ ! -f "$2" ] ; then				try=''				break			fi			;;		esac		echo -n .		try=`expr $try + 1`		sleep 1	done}case "$1" in	start)		echo -n "Starting php-fpm "		$php_fpm_BIN --daemonize $php_opts		if [ "$?" != 0 ] ; then			echo " failed"			exit 1		fi		wait_for_pid created $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed"			exit 1		else			echo " done"		fi	;;	stop)		echo -n "Gracefully shutting down php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -QUIT `cat $php_fpm_PID`		wait_for_pid removed $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed. Use force-quit"			exit 1		else			echo " done"		fi	;;	status)		if [ ! -r $php_fpm_PID ] ; then			echo "php-fpm is stopped"			exit 0		fi		PID=`cat $php_fpm_PID`		if ps -p $PID | grep -q $PID; then			echo "php-fpm (pid $PID) is running..."		else			echo "php-fpm dead but pid file exists"		fi	;;	force-quit)		echo -n "Terminating php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -TERM `cat $php_fpm_PID`		wait_for_pid removed $php_fpm_PID		if [ -n "$try" ] ; then			echo " failed"			exit 1		else			echo " done"		fi	;;	restart)		$0 stop		$0 start	;;	reload)		echo -n "Reload service php-fpm "		if [ ! -r $php_fpm_PID ] ; then			echo "warning, no pid file found - php-fpm is not running ?"			exit 1		fi		kill -USR2 `cat $php_fpm_PID`		echo " done"	;;	*)		echo "Usage: $0 {start|stop|force-quit|restart|reload|status}"		exit 1	;;esac

2.设置为自启动

chmod 775 /etc/rc.d/init.d/php-fpm #赋予文件执行权限chkconfig php-fpm on #设置开机启动service php-fpm restart #启动服务

以上是php的基本安装过程,下期介绍

扩展阅读

转载于:https://my.oschina.net/2688/blog/618406

你可能感兴趣的文章
redis限制请求频率及资源隔离
查看>>
详解Condition的await和signal等待/通知机制
查看>>
1206 - 长假之旅,即将开启
查看>>
Flutter 布局(一)- Container详解
查看>>
Log最佳实践
查看>>
App瘦身最佳实践
查看>>
图解 HTTP 的缓存机制 | 实用 HTTP
查看>>
30 天精通 RxJS(26):简易实例 Observable(一)
查看>>
Java和Docker限制的那些事儿
查看>>
掘金翻译计划周报 — 2018 年 9 月第 2 期
查看>>
整合登录界面与管理系统
查看>>
PyCon2018 回顾 (Part 1)
查看>>
vuex
查看>>
平时自己项目中用到的 CSS
查看>>
微信小程序5月带给我们的惊喜
查看>>
如何实现类似易企秀的可视化 H5 编辑器?
查看>>
[译] 游戏即服务的五条建议,提升游戏变现能力
查看>>
数据结构:链表
查看>>
gitlab迁移到docker并升级大版本到10.1.1和汉化
查看>>
多线程知识梳理(2) synchronized 三部曲之基本使用
查看>>