nginx+php(fastcgi)+mysql 安装文档-2

安装PHP相关软件包

Libmcrypt 安装

# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8/
# ./configure
# make && make install
# /sbin/ldconfig
# cd libltdl/
# ./configure --enable-ltdl-install
# make && make install
 

Mhash 安装

    # tar zxvf mhash-0.9.9.9.tar.gz
# cd mhash-0.9.9.9/
# ./configure
# make && make install
# cd ../
# ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la
# ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so
# ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4
# ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8
# ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a
# ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la
# ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so
# ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
# ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1
 

Mcrypt 安装

    # tar zxvf mcrypt-2.6.8.tar.gz
# cd mcrypt-2.6.8/
# /sbin/ldconfig
# ./configure --prefix=/opt/modules/mcrypt --with-libmcrypt-prefix=/usr/local --with-libiconv-prefix=/opt/modules/libiconv
# make && make install
 

Libevent 安装

    # tar zxvf libevent-1.4.12-stable.tar.gz
# cd libevent-1.4.12-stable
# ./configure --prefix=/opt/modules/libevent
# make && make install
 

解压php

    # tar -jxf php-5.2.11.tar.bz2
    # tar -zxf php-fpm-0.6-5.2.11.tar.gz  
 

生成php补丁   

    # ./php-fpm-0.6-5.2.11/generate-fpm-patch   # 生成php补丁文件
    # patch -d php-5.2.11 -p1 < fpm.patch       # 打补丁
    # cd php-5.2.11
    # ./buildconf �Cforce     # 这步必须执行,否则无法加with-fpm参数
    # mkdir fpm-build
    # cd fpm-build
    # ../configure --prefix=/opt/php \
        --with-config-file-path=/opt/php/etc \
        --enable-fastcgi \
        --with-fpm \
        --with-fpm-conf=/opt/php/etc/php-fpm.conf \
        --with-gd=/opt/modules/gd \
        --enable-gd-native-ttf \
        --enable-gd-jis-conv \
        --with-iconv-dir=/opt/modules/libiconv \
        --with-jpeg-dir=/opt/modules/jpeg7 \
        --with-zlib --with-png-dir=/usr/local \
        --with-freetype-dir=/opt/modules/freetype \
        --enable-mbstring \
        --with-libxml-dir=/opt/modules/libxml \
        --with-curl \
        --enable-zip \
        --enable-soap \
        --with-mcrypt \
        --with-mhash \
        --with-libevent=/opt/modules/libevent \
        --enable-xml \
        --enable-sockets  \
        --with-mysql=/opt/mysql
    # make && make install
  注:如需要添加myqli和mysql-pdo支持,可添加以下参数:
                  --with-mysqli=/opt/mysql/bin/mysql_config
     --with-pdo-mysql=/opt/mysql 

创建php.ini文件

# cp php.ini-dist /opt/php/etc/php.ini

修改php.ini参数

    # vi /opt/php/etc/php.ini
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off  关闭魔术引号,避免特殊字符转义  

配置php-fpm文件

# vi /opt/php/etc/php-fpm.conf
注意修改以下几个参数:
Unix user of processes 
         <value name="user">www</value> 
Unix group of processes 
         <value name="group">www</value>
<value name="max_children">128</value>
<value name="rlimit_files">51200</value>
 

启动FastCGI进程

# /opt/php/bin/php-fpm start
其他控制命令
start 启动phpfastcgi进程
stop 强制终止phpfastcgi进程
quit 平滑终止phpfastcgi进程
restart 重启phpfastcgi进程
reload 重新加载phpphp.ini
logrotate 重新启用log文件
memcached 安装
# cd memcached-1.4.15
#./configure \
        --prefix=/opt/memcached \
        --with-libevent=/opt/modules/libevent
# make
# make install

memcached php扩展安装 
libmemcached 库安装
# cd libmemcached-0.49
# ./configure --prefix=/opt/modules/libmemcached --with-memcached
# make 
# make install
 
memcached php安装

# cd memcached-1.0.2
# /opt/php/bin/phpize
# ./configure  \
        --enable-memcache \
        --with-php-config=/opt/php/bin/php-config \
        --with-zlib-dir \
        --with-libmemcached-dir=/opt/modules/libmemcached
# make
# make install
 
修改php.ini配置文件
# vi /opt/php/etc/php.ini
修改extension_dir目录为
extension_dir = "/opt/php/lib/php/extensions/no-debug-non-zts-20060613/"
extension=memcached.so

memcache php 扩展安装
# cd memcache-2.2.7
# /opt/php/bin/phpize
#  ./configure \
        --enable-memcache \
        --with-php-config=/opt/php/bin/php-config \
        --with-zlib-dir \
        --with-libmemcached-dir=/opt/modules/libmemcached
# make 
# make install

imagick php扩展安装
imagick依赖于imagemagick库,先安装imagemagick库
http://www.imagemagick.org/download/ImageMagick.tar.gz
# tar zxvf ImageMagick.tar.gz
# cd ImageMagick
# ./configure --prefix=/opt/modules/imagemagick
# make && make install
 
http://pecl.php.net/get/imagick-2.3.0.tgz
# tar zxvf imagick-2.3.0.tgz
# cd imagick
# /opt/php/bin/phpize
# ./configure \
        --prefix=/opt/modules/imagick \
        --with-php-config=/opt/php/bin/php-config \
        --with-imagick=/opt/modules/imagemagick
# make
# make install
修改php.ini配置文件
# vi /opt/php/etc/php.ini
extension=imagick.so
openssl php扩展安装
进入php软件目录
cd php/ext/openssl
把config0.m4改名为config.m4, 否则phpize时会报如下错误:
Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module
# /usr/local/bin/phpize
# ./configure --with-openssl --with-php-config=/opt/php/bin/php-config
# make
# make install
修改php.ini配置文件
# vi /opt/php/etc/php.ini
extension=openssl.so

你可能感兴趣的:(mysql,nginx,nginx,PHP,数据库,mysql,休闲)