Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of installing Apache in yum under CentOS 7

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the method of installing Apache in yum under CentOS 7". In the daily operation, I believe that many people have doubts about the method of installing Apache in yum under CentOS 7. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "the method of installing Apache in yum under CentOS 7". Next, please follow the editor to study!

First of all, let's talk about the scenario where the problem occurs:

Install apache with yum under CentOS 7, because the source of CentOS with php 5.4 does not meet the requirements of the environment, and you do not want to use other sources, so choose source code to compile and install php 5.6

After installation, apache does not parse the php, but the browser directly displays or downloads the source code of the php file.

A little bit about the process, the specific steps to search by themselves, and then focus on a few holes that are easy to step on.

Yum after installing apache, you must install the dependency package httpd-devel, otherwise the file apxs does not exist, and the path to apxs needs to be configured when compiling php

Yum install httpd yum install httpd-devel

View the path where apsx is located

Rpm-ql httpd-devel | grep apxs / usr/bin/apxs / / the grep result of this behavior. The paths of different systems may be different. Depending on the actual result, it is the same as / sur/share/man/man1/apxs.1.gz below.

When compiling php, add the apxs path parameter to facilitate the generation of libphp5.so

. / configure-- with-apxs2=/usr/bin/apxs

Installation

Make & & make install

Configure services, start services, and environment variables, here

Modify the apache configuration file. The configuration file path of apache2.4 under Centos7.4 is

Vim / etc/httpd/conf/httpd.conf

/ / add after LoadModule: LoadModule php5_module modules/libphp5.so / / do not add or access the .php file will become download / / add after DirectoryIndex: index.php / / add after AddType application/x-gzip .gz .tgz: AddType application/x-httpd-php .php / / there is a space in front of it.

Common command

# set boot startup: systemctl enable httpd.service# startup service: systemctl start httpd.service# stop service: systemctl stop httpd.service# restart service: systemctl reload httpd.service, the study on "how to install Apache in yum under CentOS 7" is over. I hope to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report