#!/bin/bash sudo apt install -y gcc g++ make cmake autoconf vim git zlib1g-dev libbz2-dev ibcurl4-gnutls-dev libjpeg-dev libpng12-dev libfreetype6-dev libmcrypt-dev libxml2-dev cd apt-1.5.2 ./configure --prefix=/usr/local/apr make sudo make install cd ../apr-util-* ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make sudo make install cd ../pcre-* ./configure --prefix=/usr/local/pcre make sudo make install cd ../httpd* ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --prefix=/usr/local/apache make sudo make install cd ../openssl* ./config --prefix=/usr/local/openssl shared make sudo make install cd ../php* ./configure -with-apxs2=/usr/local/apache/bin/apxs --with-mysqli --with-mysql --enable-mysqlnd --enable-mbstring --enable-bcmath --enable-sockets --enable-zip --with-bz2 --with-curl --with-gd --with-pdo-mysql --with-xmlrpc --with-zlib --prefix=/usr/local/php/php5 --with-config-file-path=/usr/local/php/php5/etc/php.ini --with-config-file-scan-dir=/usr/local/php/php5/etc/conf.d --with-openssl=/usr/local/openssl make sudo make install sudo sed -i 's/#ServerName.*/ServerName localhost/ /usr/local/apache/conf/httpd.conf' cd ../php* sudo cp php.ini-deve* /usr/local/php/php5/etc/php.ini sudo sh -c "echo Include conf/extra/httpd-php.conf >> /usr/local/apache/conf/httpd.conf" sudo sh -c "cat >> /usr/local/apache/conf/extra/httpd-php.conf <<EOF<FilesMatch \"\\.ph(p[2-6]?|tml)$\"> SetHandler application/x-httpd-php</FilesMatch><FilesMatch \"\\.phps$\"> SetHandler application/x-httpd-php-source</FilesMatch>EOF"
下面关于LAMP相关的内容你可能也喜欢:
LAMP平台安装Xcache和Memcached加速网站运行
CentOS 7下搭建LAMP平台环境
CentOS 6.5系统安装配置LAMP(Apache+PHP5+MySQL)服务器环境