分享web开发知识

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

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

linux 安装apache 2.4.9+php 7.0.28

发布时间:2023-09-06 01:46责任编辑:郭大石关键词:apache
安装准备工作
yum install -y apr- ?gcc- ?libpcre- pcre- ?openssl-*
由于系统包中的curl版本低不支持,所以需要手动下载安装
wget https://curl.haxx.se/download/curl-7.59.0.tar.gz
tar -xf curl-7.59.0.tar.gz
cd curl-7.59.0
./configure
make && make install
wget ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.3.tar.gz
tar -xf libmcrypt-2.5.3.tar.gz
cd libmcrypt-2.5.3
./configure
make && make install

wget http://mirrors.shu.edu.cn/apache//apr/apr-1.6.3.tar.gz
mkdir /usr/local/apr
tar -xf apr-1.6.3.tar.gz
cd apr-1.6.3
./configure --prefix= /usr/local/apr
make && make install
wget https://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
mkdir /usr/local/apr-util
tar -xf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1
./configure --prefix= /usr/local/apr-util
make && make install

安装apache
wget https://mirrors.tuna.tsinghua.edu.cn/apache//httpd/httpd-2.4.29.tar.gz
tar -xf httpd-2.4.29.tar.gz
mv httpd-2.4.29 httpd
cd httpd
./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --enable-so --enable-deflate --enable-expires --enable-headers --enable-ssl --enable-rewrite --enable-mpms-shared=all --with-mpm=prefork --enable-mods-shared=most

make && make install

安装php

wget http://cn2.php.net/distributions/php-7.0.28.tar.gz
tar -xf php-7.0.28.tar.gz
mv php-7.0.28 php
cd php
./configure --prefix=/usr/local/php/ --with-apxs2=/usr/local/apache2/bin/apxs ?--enable-pdo --with-pdo-mysql --with-mysql-sock --enable-xml --with-libxml-dir --enable-sockets --with-curl --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-mcrypt --with-openssl --with-mhash --enable-zip --enable-mbstring --enable-mbregex --with-iconv --enable-static

make && make install

修改配置:
修改apache httpd.conf
在195行去除“#” 修改为:ServerName localhost:80
在253行中添加index.php
DirectoryIndex index.php index.html
在390行后面添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

配置php 首页index.php
在/usr/local/apache2/htdocs 中创建index.php
vim index.php
将以下内容输入文件中
<?php
phpinfio();
?>
保存退出。
启动httpd服务
/usr/local/apache2/bin/apachectl start

PHP就配置好了。

linux 安装apache 2.4.9+php 7.0.28

原文地址:http://blog.51cto.com/3001441/2089515

知识推荐

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