分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

源码安装CentOs7下的PHP7

发布时间:2023-09-06 02:10责任编辑:董明明关键词:PHP

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

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

然后安装mysql(mariadb)

yum install mariadb mariadb-servercp /usr/share/mysql/my-huge.cnf /etc/my.cnfvi /etc/my.cnf#最后添加 log-slow-queries=/var/log/mariadb/slow.loglong_query_time=1log-queries-not-using-indexessystemctl start mariadb.servicemysql_secure_installation #(改密码,如果有密码 可能是root1234)

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

#下载镜像文件wget http://hk1.php.net/get/php-7.2.8.tar.gz/from/this/mirror tar zxvf mirrorcd 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 /etcLoadModule 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

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved