安装lamp之一键安装php-创新互联
#!/bin/sh
创新互联公司主要业务有网站营销策划、成都网站建设、成都网站制作、微信公众号开发、小程序制作、H5建站、程序开发等业务。一次合作终身朋友,是我们奉行的宗旨;我们不仅仅把客户当客户,还把客户视为我们的合作伙伴,在开展业务的过程中,公司还积累了丰富的行业经验、成都全网营销推广资源和合作伙伴关系资源,并逐渐建立起规范的客户服务和保障体系。#一键安装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
#上面安装完还是没有libiconv库,需要编译安装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环境是否成功 window 打开10.0.0.4 另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。
分享标题:安装lamp之一键安装php-创新互联
链接URL:http://hbruida.cn/article/gcicg.html