标签:php7 apach
一、安装apache http服务1、下载http所需的包,在apache的源码文件READ.cmake里可以看到依赖,只要按照那个下载相应的版本就行
apr-1.5.2.tar.gz https://pan.baidu.com/s/11PUxyiZ92mrMbhF9z2ktBQ apr-util-1.5.2.tar.gz https://pan.baidu.com/s/1mIQPb7fyi3TzP_6Wfb_nGg |
2、安装apache http服务
官网下载httpd-2.4.33包,并解压(我这里解压到/root下)
cp apr-1.5.2/* /root/httpd-2.4.33/srclib/ cp apr-util-1.5.2/* /root/httpd-2.4.33/srclib/apr-util cd httpd-2.4.33 ./configure —prefix=/usr/local/http make && make install //没有报错说明安装成功,也可以看看/usr/local/http是否已经生成二、安装php服务 |
二、php安装
1、安装依赖软件
yum -y install openssl
yum -y install openssl-devel
yum -y install curl
yum -y install curl-devel
yum -y install libjpeg
yum -y install libjpeg-devel
yum -y install libpng
yum -y install libpng-devel
yum -y install freetype
yum -y install freetype-devel
yum -y install pcre
yum -y install pcre-devel
yum -y install libxslt
yum -y install libxslt-devel
yum -y install bzip2
yum -y install bzip2-devel
2、安装php服务
官网下载php-7.2.4软件包并解压
cd php-7.2.4 ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/http/bin/apxs --enable-mysqlnd \--with-mysqli --with-pdo-mysql --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip |
说明:--with-apxs2=/usr/local/http/bin/apxs 这个选项是为了在http模块目录下生成php模块文件libphp7.so
3、配置修改
因为我是用作phpMyadmin,所以把php对上传的限制修改了,具体如下:
cp php.ini-development /usr/local/php/lib/php.ini //php.ini-development 在源码包的根目录下 vim /usr/local/php/lib/php.ini //修改文件上传大小 post_max_size = 200M upload_max_filesize = 200M |
三、配置http
配置文件:/usr/local/http/conf/httpd.conf
在LoadModule处添加
LoadModule php7_module modules/libphp7.so
末尾添加
<FilesMatch \.php$> SetHandler application/x-httpd-php
</FilesMatch>
修改以下内容(增加apache类型查找文件index.php)
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
其他更改服务访问端口等配置,不在这里说明
四、启动apache
/usr/local/http/bin/apachectl -k start
标签:php7 apach
原文地址:http://blog.51cto.com/tsing/2093070