码迷,mamicode.com
首页 > Web开发 > 详细

源码安装CentOs7下的PHP7

时间:2018-08-15 14:03:34      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:art   class   modules   enable   centos7   app   eve   x86   usr   

首先安装APACHE环境,直接用yum安装

yum install httpd httpd-devel
/etc/httpd/
systemctl start httpd.service #启动apache
systemctl stop httpd.service #停止apache
systemctl restart httpd.service #重启apache

然后安装mysql(mariadb)

yum install mariadb mariadb-server
cp /usr/share/mysql/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf
#最后添加 
log-slow-queries=/var/log/mariadb/slow.log
long_query_time=1
log-queries-not-using-indexes

systemctl start mariadb.service
mysql_secure_installation #(改密码,如果有密码 可能是root1234)

完装完这两个环境之后,现在源码安装PHP7.2.8

#下载镜像文件
wget http://hk1.php.net/get/php-7.2.8.tar.gz/from/this/mirror 
tar zxvf mirror
cd php-7.2.8

#如果是新环境,需要安装一些依赖
yum install autoconf gcc  httpd-devel libxml2 libxml2-*  openssl.x86_64 openssl-devel.x86_64  libcurl.x86_64 libcurl-devel.x86_64  libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64  libjpeg-turbo-devel -y

./configure --with-mysqli --with-curl --with-apxs2=/usr/bin/apxs --with-openssl --enable-mbstring --with-gd --enable-gd-native-ttf --enable-gd-jis-conv --with-jpeg-dir --with-config-file-path=/etc/php.ini 

make && make install

 

之后要配置APACHE的配置文件

vi /etc/httpd/conf/httpd.conf
#找到LoadModule 大约在54行左右,在注释下面,加入下面的配置
#php.ini的目录
PHPIniDir /etc
LoadModule php7_module /usr/lib64/httpd/modules/libphp7.so

#解析.php文件
<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>


AddType application/x-httpd-php .php

之后重启apache就可以使用了

systemctl restart httpd.service

 

源码安装CentOs7下的PHP7

标签:art   class   modules   enable   centos7   app   eve   x86   usr   

原文地址:https://www.cnblogs.com/cutchaos/p/9480896.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!