ホームページ >バックエンド開発 >PHPチュートリアル >PHPに基づいてwwwサーバーを構築する

PHPに基づいてwwwサーバーを構築する

WBOY
WBOYオリジナル
2016-06-23 13:30:211183ブラウズ

安装MySQL

#!/bin/bashmount |grep "/dev/sr0"if [ "$?" != 0 ];then    mount /dev/sr0 /mediafi[ "$?" != 0 ]&& echo "fail to mount ! exit " && exit yum -y install gcc-c++ ncurses-devel perl-devel rpm -q  gcc-c++ ncurses-devel perl-devel if [ "$?" != 0 ]; then    echo "install error "    yum -y remove gcc-c++ ncurses-devel perl-devel      if [ "$?" != 0 ]; then     echo "remove error "    fifi# install Cmakecmakeif [ "$?" != 0 ];then    cd /root/db/    tar zxf /root/db/cmake-3.1.0-rc3.tar.gz      # get the directory after unzip     dname=`ls -al /root/db/ |grep "^d" |grep ".*cmake.*"|awk '{print $9}'`     echo "directory: "$dname    if [ ! -d $dname ]; then        echo "fail unzip "        exit     fi    cd /root/db/$dname    echo "enter " `pwd`    ./bootstrap     if [ "$?" == 0 ];then        gmake         if [ "$?" == 0 ]; then            gmake install             if [ "$?" == 0 ]; then                echo "success"            else                 echo "gmake install fail ! exit "                exit             fi        else             echo "gmake fail ! exit "        fi    else         echo " ./bootstrap fail exit "        exit     fielse     echo "Cmake already installed "fi# install mysql cd /root/db/tar zxvf /root/db/mysql-5.6.20.tar.gzmysqlD=`ls -al /root/db/ |grep "^d" |grep ".*mysql.*"|awk '{print $9}'` echo "mysql directory: "$mysqlDif [ ! -d $mysqlD ]; then    echo "mysql fail unzip "    exit ficd /root/db/$mysqlDcmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysqlmake && make install# configure mysqlecho "PATH=$PATH:/usr/local/mysql/bin/" >> /etc/profilesource /etc/profileuseradd mysqlif [ "$?" != 0 ]; then    echo "adduser error "    exit fichown -R mysql:mysql /usr/local/mysql/cd /usr/local/mysql/echo "enter "`pwd`./scripts/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysqlcp support-files/mysql.server /etc/init.d/mysqldchkconfig mysqld onmv /etc/my.cnf /etc/my.cnf.bkservice mysqld start 

搭建www服务器以及PHP功能

#!/bin/bashmount |grep "/dev/sr0"if [ "$?" != 0 ]; then    mount /dev/sr0 /media fi[ "$?" != 0 ] && echo "fail to mount ! exit " && exit # install gcc-c++rpm -q gcc-c++if [ "$?" != 0 ]; then    yum -y install gcc-c++fi# remove httpdrpm -q httpd if [ "$?" == 0 ]; then    rpm -e httpd --nodepsfiyum -y install perl-devel freetype-devel libxml2-devel libXpm-devel zlib-devel libpng-devel[ "$?" != 0 ] && echo "perl-devel freetype-devel libxml2-devel libXpm-devel zlib-devel libpng-devel yum error ! exit " && exit # install APR(Apache Portable Runtime)tar -jxvf /root/web/apr-1.5.1.tar.bz2APR=`ls -al /root/web/ |grep "^d" |grep ".*apr.*"|awk '{print $9}'` [ "$APR" == "" ] && echo " apr unzip error ! exit " && exit cd /root/web/$APRecho "enter " `pwd`./configure --prefix=/usr/local/aprif [ "$?" ==  0 ];then    make && make install     if [ "$?" == 0 ]; then         echo "apr install success"    else         echo "apr make && make install error ! exit "        exit     fielse     echo "apr ./configure error ! exit "    exit fi# install apr-utiltar -jvxf /root/web/apr-util-1.5.3.tar.bz2APRU=`ls -al /root/web/ |grep "^d" |grep ".*apr-util*"|awk '{print $9}'` [ "$APRU" == "" ] && echo " apr-util unzip error ! exit " && exit echo "apr-util "$APRUcd /root/web/$APRUecho "enter "$APRU./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/if [ "$?" ==  0 ];then    make && make install     if [ "$?" == 0 ]; then         echo "apr-util install success"    else         echo "apr-util make && make install error ! exit "        exit     fielse     echo "apr-util ./configure error ! exit "    exit fi#install pcreecho "start instal pcre "echo "current directory is : " `pwd`cd /root/web/tar -jvxf /root/web/pcre-8.35.tar.bz2 PCRE=`ls -al /root/web/ |grep "^d" |grep ".*pcre.*"|awk '{print $9}'` echo "find pcre in /root/web/" $PCRE [ "$PCRE" == "" ] && echo " pcre unzip error ! exit " && exit echo "pcre : "$PCREcd /root/web/$PCREecho "enter pcre: " $PCRE./configure --prefix=/usr/local/pcreif [ "$?" ==  0 ];then    make && make install     if [ "$?" == 0 ]; then         echo "pcre install success"    else         echo "pcre make && make install error ! exit "        exit     fielse     echo "pcre ./configure error ! exit "    exit fi#apache installcd /root/web/tar -jvxf /root/web/httpd-2.4.10.tar.bz2HTTPD=`ls -al /root/web/ |grep "^d" |grep ".*httpd.*"|awk '{print $9}'` [ "$HTTPD" == "" ] && echo " httpd unzip error ! exit " && exit cd /root/web/$HTTPD./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-cgi --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre/if [ "$?" ==  0 ];then    make && make install     if [ "$?" == 0 ]; then         echo "httpd install success"    else         echo "httpd make && make install error ! exit "        exit     fielse     echo "httpd ./configure error ! exit "    exit fi

 

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。