#!/bin/sh
創(chuàng)新互聯(lián)公司主要業(yè)務有網(wǎng)站營銷策劃、成都網(wǎng)站建設、成都網(wǎng)站制作、微信公眾號開發(fā)、小程序制作、H5建站、程序開發(fā)等業(yè)務。一次合作終身朋友,是我們奉行的宗旨;我們不僅僅把客戶當客戶,還把客戶視為我們的合作伙伴,在開展業(yè)務的過程中,公司還積累了豐富的行業(yè)經(jīng)驗、成都全網(wǎng)營銷推廣資源和合作伙伴關系資源,并逐漸建立起規(guī)范的客戶服務和保障體系。#一鍵安裝php
#xiaogao 20190921
#安裝依賴包:
yum install zlib libxml libjpeg freetype libpng gd curl libiconv zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel libxslt-devel openssl* -y
#上面安裝完還是沒有l(wèi)ibiconv庫,需要編譯安裝libiconv庫。如果無法下載,就先下載在上傳到/home/lvnian/tools/
[ -e /home/lvnian/tools/ ] || mkdir -p /home/lvnian/tools/
cd /home/lvnian/tools/
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
tar zxf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/local/libiconv
make
make install
cd ..
#安裝php
tar zxf php-5.3.27.tar.gz
cd php-5.3.27
./configure \
--prefix=/application/php5.3.27 \
--with-apxs2=/application/apache/bin/apxs \
--with-mysql=/application/mysql \
--with-xmlrpc \
--with-openssl \
--with-zlib \
--with-freetype-dir \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-iconv=/usr/local/libiconv \
--enable-short-tags \
--enable-sockets \
--enable-zend-multibyte \
--enable-soap \
--enable-mbstring \
--enable-static \
--enable-gd-native-ttf \
--with-curl \
--with-xsl \
--enable-ftp \
--with-libxml-dir
make && make install
#制作軟連接
ln -s /application/php5.3.27/ /application/php
ls /application
##配置配置文件
cp /home/lvnian/tools/php-5.3.27/php.ini-production /application/php/lib/php.ini
##修改apache配置文件httpd.conf.使其支持php
#到311加下面兩行
#AddType application/x-httpd-php .php .phtml
#AddType application/x-httpd-php-source .phps
sed -n '310,315p' /application/apache/conf/httpd.conf
sed -i '311aAddType application/x-httpd-php .php .phtml\nAddType application/x-httpd-php-source .phps' /application/apache/conf/httpd.conf
sed -n '310,315p' /application/apache/conf/httpd.conf
#修改daemon用戶和組 lvnian
useradd lvnian -s /sbin/nologin -M
sed -i 's/User daemon/User lvnian/g' /application/apache/conf/httpd.conf
sed -i 's/Group daemon/Group lvnian/g' /application/apache/conf/httpd.conf
sed -n '/lvnian/p' /application/apache/conf/httpd.conf
##修改首頁文件
grep 'DirectoryIndex index.html' /application/apache/conf/httpd.conf
sed -i "s# DirectoryIndex index.html# DirectoryIndex index.php index.html#g" /application/apache/conf/httpd.conf
grep 'DirectoryIndex ' /application/apache/conf/httpd.conf
##重啟apache
/application/apache/bin/apachectl stop
/application/apache/bin/apachectl start
##檢查安裝php是否成功
cd /application/apache/htdocs
cat >>index.php< //$conne=mysql_connect('主機名','用戶','密碼'); $link_id=mysql_connect('localhost','root','lvnian') or mysql_error(); if($conne){ echo "mysql successful by xiaogao!"; }else{ echo mysql_error(); } ?> phpinfo(); ?> EOF ###測試lamp環(huán)境是否成功 window 打開10.0.0.4 另外有需要云服務器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內外云服務器15元起步,三天無理由+7*72小時售后在線,公司持有idc許可證,提供“云服務器、裸金屬服務器、高防服務器、香港服務器、美國服務器、虛擬主機、免備案服務器”等云主機租用服務以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務可用性高、性價比高”等特點與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應用場景需求。
網(wǎng)站標題:安裝lamp之一鍵安裝php-創(chuàng)新互聯(lián)
URL網(wǎng)址:http://weahome.cn/article/gcicg.html