完成了php5.3.10第一個階段的部署,然後做了一個總結,把php的部署寫成shell script 自動,並有利於以後慢慢擴展,並實踐一下之前學習的shell script
環境:
----------------------------
System | CentOS-5.7
----------------------------
腳本如下:
[plain]
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
echo "Error: You must be root to run this script, please use root to install php"
exit 1
fi
clear
echo "========================================================================="
echo "PHP install shell script for CentOS/RadHat Written by Qzi"
echo "========================================================================="
echo "========================================================================="
echo "PHP Version: 5.3.10"
echo "========================================================================="
cur_dir=$(pwd)
rpm -qa|grep php
rpm -e php
echo "========================================================================="
echo "install dependences"
echo "========================================================================="
#for packages in patch make gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip autoconf;
#do yum -y install $packages; done
echo "============================check files=================================="
if [ -s php-5.3.10.tar.gz ]; then
echo "php-5.3.10.tar.gz [found]"
else
echo "Error: php-5.3.10.tar.gz not found!!!download now......"
wget -c wget http://www.php.net/get/php-5.3.10.tar.gz/from/us.php.net/mirror
fi
if [ -s libiconv-1.14.tar.gz ]; then
echo "libiconv-1.14.tar.gz [found]"
else
echo "Error: libiconv-1.14.tar.gz not found!!!download now......"
wget -c http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
fi
echo "============================check files=================================="
echo "============================php install=================================="
cd $cur_dir
tar -zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/opt/php/3rdlibs/libiconv-1.14/
make ZEND_EXTRA_LIBS = -liconv
make && make install
ls /opt/php/3rdlibs/libiconv-1.14/
cd ../
tar -zxvf php-5.3.10.tar.gz
cd php-5.3.10
./configure \
--prefix=/opt/php \
--with-config-file-path=/opt/php/etc \
--with-iconv-dir=/opt/php/3rdlibs/libiconv-1.14 \
--with-pgsql=/opt/pgsql \
--enable-fpm
make && make install
cd ../
#echo "============================php complete================================="
#exit 0
依賴部分有點過了,那是為了nginx 和數據庫做准備的,php 擴展也是少,不過暫時不想添加,學習到哪個再添加 ...
建立了一個php群,歡迎一起學習(QQ群號:213572677)
Enjoy it !