ubuntu下编译安装php-5.4.8

#编译安装php,fastCGI模式
# apt-get -y install libxml2 libxml2-dev autoconf libjpeg-dev libpng-dev php5-gd

# apt-get -y install bzip2 libbz2-dev curl libcurl4-gnutls-dev libfreetype6-dev

# 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/lib/x86_64-linux-gnu/ \
--with-png-dir=/usr/lib/x86_64-linux-gnu/ \
--with-freetype-dir=/usr/lib/x86_64-linux-gnu/ \
--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

#加入开机启动

# sysv-rc-conf

#找到php-fpm一栏,勾选3,4,5,按q退出 
# /etc/init.d/php-fpm start
#测试篇
# 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-11-25 18:10  lwysoft  阅读(1140)  评论(0编辑  收藏  举报

导航