CentOS install Apache and PHP instances to share

Source: Internet
Author: User
This article mainly share with you the CentOS installation of Apache and PHP instances, I hope to help everyone.

First, the installation package

Apache httpd 2.4.27.tar.gz, apr-1.6.2.tar.gz, apr-util-1.5.2.tar.gz, pcre-8.41.tar.gz, php-7.1.9.tar.bz2.tar.bz2.tar.bz2

Second, check the installation environment

The display has been installed httpd2.2.15. In order to not affect the new version, you should uninstall the system's own version

Be sure to uninstall!!!!! (There is also a package deletion operation, if the error message is dependent on the package: Rpm–e–nodeps package name, can be deleted)

Three, the installation of various packages

1, first create the directory: Mkdir/usr/local/soft for the storage of various installation packages

Mkdir/usr/local/apr

Mkdir/usr/local/apr-util

Mkdir/usr/local/httpd

Mkdir/usr/local/pcre

2, the first installation apr-1.6.2:

Extract:

Compile:

Prompt for such error:rm:cannot remove ' libtoolt ': Nosuch file or directory(about 30351 Line, command: Vim +30351 Configure)

Workaround: Add Configure in the file rm= ' $RM ' instead rm= ' $RM –f ' . Save exit if Wq can not save exit, use:wq!, Force save exit!

Compile again:

WORKAROUND: Delete the phrase "$cfgfile" in the Configure file $RM. (This can be ignored without affecting the subsequent installation)

Compile successfully, install:

3, Installation apr-util-1.5.2

After decompression, enter apr-util-1.5.2 to compile:

Compile successful installation: Make && make install

4, Installation pcre-8.41

After decompression, enter the pcre-8.41 directory to compile:

Compilation successfully installed:make&& make install

If the report

instructions need to be installed gcc-c++, command: Yum List Check to see if there are any installation packages in the system and download them. and then install. No special instructions are made here ...

5, Installation httpd-2.4.27

After the same compile:./configure--prefix=/usr/local/httpd--with-pcre=/usr/local/pcre--with-apr=/usr/local/ Apr--with-apr-util=/usr/local/apr-util

Compile without error installing:make&& make install

6. Configure and start Apache

Enter/usr/local/httpd/bin

Run command:./apachectl start

Tips:

Workaround: Open httpd.conf file that will #ServerNamewww.example.com:80 to ServerName ip:80

D. Set Apache to Linux system service, boot up

1. Copy the link Apachectl to the system startup directory and name it httpd

2. Registering Apache Service

Command:vim/etc/rc.d/init.d/httpd

in the # ! add 2 lines under/bin/sh: #chkconfig: #description: Apache

3, the httpd configuration automatically to and join the Linux service monitoring

V. Enter in the browser: http://ip:80

Configuration Successful!!

If the Web page test is unsuccessful, turn off the firewall: iptables–f, just in case it can be set to power on disable: Chkconfig iptables off

Vi. installation of php-7.1.9

First decompression: Bzip2–d php-7.1.9.tar.bz2.tar.bz2.tar.bz2

TAR–XVF Php-7.1.9.tar.bz2.tar.bz2.tar

Go to configuration directory: CD php-7.1.9

Enter the command to install the configuration:./configure--prefix=/usr/local/php--with-apxs2=/usr/local/httpd/bin/apxs

Installation: Make && make install

Configure the Apache configuration file after the installation is complete

Vi/usr/local/httpd/conf/httpd.conf

Find a place to AddType add a row

addtype application/x-httpd-php. PHP (Note the space!!!!!!! )

Find DirectoryIndex index.html

Add a index.php or default.php to index.html

Restart Apache

Complete!

Related recommendations:

PHP Basic Windows Environment installation Apache Mysql PHP (figure)

Install Apache under Linux Specify the installation module and post install to load other modules

CENTOS66 installation Apache24

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.