Completed the first phase of deployment of php5.3.10, and then made a summary, writing the deployment of php as a shell script automatically, which will facilitate the gradual expansion in the future, and practice the shell script learned before
Environment:
----------------------------
System | CentOS-5.7
----------------------------
The script is as follows:
[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
The dependency part is a bit overdone. It is to prepare for nginx and database. There are also few PHP extensions, but I don’t want to add them for the time being. I will add them when I learn more...
A php group has been established, welcome to learn together (QQ group number: 213572677)
Enjoy it!