欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

php5.3.10自动化部署脚本第一版

程序员文章站 2024-01-09 13:41:16
...
完成了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 !


摘自 GameRoler

上一篇:

下一篇: