###安装包下载地址: apache 下载地址:http://mirror.bit.edu.cn/apache/httpd/httpd-2.4.29.tar.gz php下载地址:http://cl1.php.net/get/php-7.1.10.tar.gz/from/this/mirror apr:http://mirrors.noc.im/apache/apr/apr-1.5.2.tar.bz2 apr-util:http://mirrors.noc.im/apache//apr/apr-util-1.5.4.tar.bz2 pcre: http://iweb.dl.sourceforge.net/project/pcre/pcre/8.38/pcre-8.38.zip ####卸载残余环境:
rpm -e `rpm -qa|grep -E "httpd|php"`
###安装apache ####1. 安装apr
tar -xvf apr-1.5.2.tar.bz2
cd apr-1.5.2
./configure --prefix=/usr/local/apr
make && make install
####2. 安装apr-util
tar -xvf apr-util-1.5.4.tar.bz2
cd apr-util-1.5.4
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
make && make install
####3. 安装pcre
unzip pcre-8.38.zip
cd pcre-8.38
./configure --prefix=/usr/local/pcre
make && make install
####4. 安装apache
tar -xvf httpd-2.4.29.tar.gz
cd httpd-2.4.29
./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre --enable-so --enable-rewrite
make && make install
cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd
chkconfig --add httpd
chkconfig httpd on
###安装php ####1. 安装依赖包
yum install libwebp libwebp-devel ImageMagick libxml2-devel.x86_64 openssl.x86_64 openssl-devel.x86_64 bzip2-devel.x86_64 libcurl.x86_64 libcurl-devel.x86_64 libjpeg libpng.x86_64 freetype.x86_64 libjpeg-devel libpng-devel.x86_64 freetype-devel.x86_64 mysql-devel libmcrypt libmcrypt-devel -y
####2. 编译安装php
tar -xvf php-7.1.10.tar.gz
cd php-7.1.10
./configure --prefix=/usr/local/php --with-libxml-dir --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-gd --enable-gd-native-ttf --with-jpeg-dir --with-png-dir --with-webp-dir --with-zlib --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
make && make install
cp php.ini-development /usr/local/php/lib/php.ini
####3. 配置apache支持php
vim /usr/local/apache/conf/httpd.conf
添加 AddType application/x-httpd-php .php .html
####4. 配置环境变量
echo "export PATH=/usr/local/php/bin:/usr/local/apache/bin:$PATH" >>/etc/profile
source /etc/profile
###php添加扩展 ####1. redis扩展
wget http://pecl.php.net/get/redis-3.1.0.tgz
tar zxf redis-3.1.0.tgz
cd redis-3.1.0
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
修改/usr/local/php/lib/php.ini打开
extension=redis.so
####2. tidy扩展
yum install libtidy libtidy-devel -y
cd php-7.1.10
cd extend
cd tidy
/usr/local/php/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config
make && make install
修改/usr/local/php/lib/php.ini打开
extension=tidy.so
评论区