[6] 编译安装php-5.4.8

#编译安装php,fastCGI模式
# yum -y install gcc gcc-c++ libxml2 libxml2-devel autoconf libjpeg libjpeg-devel libpng libpng-devel gd

# yum -y install bzip2 bzip2-devel curl curl-devel freetype freetype-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel 

# cd /usr/software
# wget http://www.ijg.org/files/jpegsrc.v8d.tar.gz
# wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
# wget http://cn2.php.net/get/php-5.4.8.tar.gz/from/this/mirror

 

#安装 jpeg
# tar zxvf jpegsrc.v8d.tar.gz
# cd jpeg-8d
# ./configure -enable-shared -enable-static
# make && make install clean
# cd ..
#安装libmcrypt
# tar zxvf libmcrypt-2.5.8.tar.gz
# cd libmcrypt-2.5.8
# ./configure
# make && make install
# cd ..
#安装php
# tar zvxf php-5.4.8.tar.gz
# cd php-5.4.8
# mkdir -p /usr/local/php
# ./configure --prefix=/usr/local/php \
--with-apxs2=/usr/local/apache/bin/apxs \
--with-libxml-dir=/usr/include/libxml2 \
--with-config-file-path=/usr/local/php/etc/ \
--with-mysql=/usr/local/mysql \
--with-mysqli=/usr/local/mysql/bin/mysql_config \
--with-gd \
--enable-gd-native-ttf \
--with-zlib \
--with-mcrypt \
--with-pdo-mysql=/usr/local/mysql \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-wddx \
--enable-zip \
--with-xmlrpc \
--enable-fpm \
--enable-mbstring \
--with-zlib-dir \
--with-bz2 \
--with-curl \
--enable-exif \
--enable-ftp \
--with-jpeg-dir=/usr/lib64 \
--with-png-dir=/usr/lib64 \
--with-freetype-dir=/usr/lib64 \
--with-iconv \
--enable-xml \
--enable-bcmath \
--enable-sysvsem \
--enable-inline-optimization \
--with-curlwrappers \
--enable-mbregex \
--with-openssl \
--enable-pcntl \
--with-gettext \
--enable-session
 
# make
# make install
# cp php.ini-production /usr/local/php/etc/php.ini
 
# rm -rf /etc/php.ini
# ln -s /usr/local/php/etc/php.ini /etc/php.ini
# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# vi /usr/local/php/etc/php-fpm.conf
user = www
group = www
#取消前面的分号
pid = run/php-fpm.pid
:wq
#设置 php-fpm开机启动
# cp /usr/software/php-5.4.8/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm
# chkconfig --add php-fpm
# chkconfig php-fpm on
# service php-fpm start

# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 9000 -j ACCEPT 

:wq

# service iptables restart 

#测试篇
# cd /usr/local/apache/htdocs
# vi index.php
<?php
phpinfo();
?>
:wq!
# chown -R www.www /usr/local/apache/htdocs

#配置apache以module方式使用php 

# vi /usr/local/apache/conf/httpd.conf 

<IfModule mime_module> 

    #此处添加php handler 

    AddType application/x-httpd-php .php .phtml

    AddType application/x-httpd-php-source .phps

    PHPIniDir "/etc" 

</IfModule>

DirectoryIndex index.html index.php

#禁止文件列表功能 

#Options Indexes FollowSymLinks 

Options FollowSymLinks

#允许配置重写 

#AllowOverride None 

AllowOverride All

:wq 

# service httpd restart

# 访问 http://192.168.203.80/index.php

#至此php安装完成

posted on 2012-10-28 19:45  lwysoft  阅读(328)  评论(0编辑  收藏  举报

导航