Linux下Memcached+Nginx+PHP安装手册(2)

 

 

首页服务器应用

背景:

阅读新闻

Linux下Memcached+Nginx+PHP安装手册

[日期:2013-05-26]   来源:Linux社区  作者:xinyuyuanm   [字体:]  

PHP安装

下载php安装包:

(下面这些库都是以前安装好的!如果换新环境须要自己装)

tar xzf php-5.4.15.tar.gz&&

cd php-5.4.15

1、安装libxml2库

./configure --prefix=/app/apache/lib/libxml2&&

make && make install

2、安装libmcrypt库

./configure --prefix=/app/apache/lib/libmcrypt &&

make&& make install

3、安装libpng库(libpng-1.2.31.tar.gz)

./configure --prefix=/app/apache/lib/libpng&&

make && make install

如果涌现:configure: error: zlib not installed

执行如下命令,使之前安装的zlib库立即生效:

exportLDFLAGS="-L/app/apache/lib/zlib/lib"

exportCPPFLAGS="-I/app/apache/lib/zlib/include"

4、安装jpeg9库

./configure --prefix=/app/apache/lib/jpeg9 \

--enable-shared\

--enable-static&&

make &&make install

5、安装freetype库

./configure --prefix=/app/apache/lib/freetype&&

make && make install

6、安装autoconf库

./configure&& make && make install (直接安装到系统库,不用指定安装目录)

7、安装gd库

./configure--prefix=/app/apache/lib/gd2 \

--with-zlib=/app/apache/lib/zlib/ \

--with-jpeg=/app/apache/lib/jpeg9/ \

--with-png=/app/apache/lib/libpng/ \

--with-freetype=/app/apache/lib/freetype/&&

make && make install

在64位系统中会涌现以下错误:

make[2]: ***[gdparttopng] Error 1

make[2]: Leavingdirectory `/app/src/gd-2.0.35'

make[1]: ***[all-recursive] Error 1

make[1]: Leavingdirectory `/app/src/gd-2.0.35'

make: *** [all]Error 2

安装以下rpm包可解决:

rpm –ivh zlib-devel-1.2.3-27.el6.x86_64.rpm(先安装这个,后面的依附这个)

rpm –ivh libjpeg-devel-6b-46.el6.x86_64.rpm

rpm –ivh freetype-devel-2.3.11-6.el6_1.7.x86_64.rpm

rpm –ivh libpng-devel-1.2.46-1.el6_1.x86_64.rpm

8、安装php

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

./configure --with-MySQL=/app/mysql5.6 &&

./configure --with-mysqli=/app/mysql5.6/bin/mysql_config &&

./configure --with-libxml-dir=/app/apache/lib/libxml2 &&

./configure --with-png-dir=/app/apache/lib/libpng &&

./configure --with-jpeg-dir=/app/apache/lib/jpeg9 &&

./configure --with-freetype-dir=/app/apache/lib/freetype &&

./configure --with-gd=/app/apache/lib/gd2 &&

./configure --with-zlib-dir=/usr/local/zlib &&

./configure --with-mcrypt=/app/apache/lib/libmcrypt &&

./configure --enable-soap &&

./configure --enable-mbstring=all &&

./configure --enable-sockets &&

./configure --enable-fastcgi &&

./configure --enable-fpm &&

make && make install

Nginx整合php

nginx.conf 中注释失落的php代码段注释取消

#pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

location ~ \.php$ {

root html;

fastcgi_pass 127.0.0.1:9000;

fastcgi_index index.php;

fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

include fastcgi_params;

}

复制php.ini配置文件

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

复制php-fpm配置文件

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

创立

php-fpm服务

vi /etc/init.d/php-fpm

输入:

#!/bin/bash

#

# Startup script for the PHP-FPM server.

#

# chkconfig: 345 85 15

# description: PHP is an HTML-embeddedscripting language

# processname: php-fpm

# config: /usr/local/php/etc/php.ini

# Source function library.

. /etc/rc.d/init.d/functions

PHP_PATH=/usr/local

DESC="php-fpm daemon"

NAME=php-fpm

DAEMON=$PHP_PATH/sbin/$NAME

CONFIGFILE=$PHP_PATH/etc/php-fpm.conf

PIDFILE=$PHP_PATH/var/run/$NAME.pid

SCRIPTNAME=/etc/init.d/$NAME

# Gracefully exit if the package has beenremoved.

test -x $DAEMON || exit 0

rh_start() {

$DAEMON -y $CONFIGFILE || echo -n " already running"

}

rh_stop() {

kill -QUIT `cat $PIDFILE` || echo -n " not running"

}

rh_reload() {

kill -HUP `cat $PIDFILE` || echo -n " can't reload"

}

case "$1" in

start)

echo -n "Starting $DESC: $NAME"

rh_start

echo "."

;;

stop)

echo -n "Stopping $DESC: $NAME"

rh_stop

echo "."

;;

reload)

echo -n "Reloading $DESC configuration..."

rh_reload

echo "reloaded."

;;

restart)

echo -n "Restarting $DESC: $NAME"

rh_stop

sleep 1

rh_start

echo "."

;;

*)

echo "Usage: $SCRIPTNAME {start|stop|restart|reload}">&2

exit 3

;;

esac

exit 0

保存退出

然后修改php-fpm.conf

vi/usr/local/etc/php-fpm.conf

取消失落pid = run/php-fpm.pid此行后面的;号指定pid生成的目录给下面脚本使用

php-fpm加入服务自启动脚本

cd /etc/init.d &&

chmod 755 php-fpm &&

chkconfig --add php-fpm &&

chkconfig php-fpm on

启动:

service php-fpm start

第一次搭建环境 大家有什么缺乏的可以指出来改正

 

基于RHCS+iSCSI+CLVM实现Web服务的共享存储集群架构

使用bind配置DNS服务器---初级篇

相关资讯      

   

本文评论   查看全部评论 (0)


评论声明

尊重网上道德,遵守中华人民共和国的各项有关法律法规

承担一切因您的行为而直接或间接导致的民事或刑事法律责任

本站管理人员有权保留或删除其管辖留言中的任意内容

本站有权在网站内转载或引用您的评论

参与本评论即表明您已经阅读并接受上述条款

 

 

 

最新资讯

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/e487c8d7e1fcd4d50768833c7290ba50.html