完成了php5.3.10第一个阶段的部署,然后做了一个总结,把php的部署写成shell script 自动,并有利于以后慢慢扩展,并实践一下之前学习的shell script
环境:
----------------------------
System | CentOS-5.7
----------------------------
脚本如下:
#!/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 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 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