Linux source code compilation Apache2.2.19 + PHP5.3.6

Source: Internet
Author: User
1. compilation and installation sequence: first install apache and then install php, because php compilation will use apache's apxs module. If php is installed first, then install apache, you need to re-compile php2. install apache1. check the compiling environment in linux, execute the following command: [root@www.linuxidc.com] # rpm-qa | grepgcc # output gcc

1. Compilation and installation sequence problems: install apache first, and then installPhpBecause php compilation will use apache's apxs module. If you install php first and then install apache, you need to re-compile php.

2. install apache

1. ConfirmLinuxIn the compilation environment, run the following:Command:

 Root@www.linuxIdC.com/] #Rpm-qa |GrepGcc# Output related packages in the gcc Environment

Gcc-java-3.4.5-2 Libgcc-3.4.5-2 Gcc-3.4.5-2 Compat-libgcc-296-2.96-132.7.2 Compat-gcc-32-3.2.3-47.3 Gcc-c ++-3.4.5-2 Compat-gcc-32-c +-3.2-47.3 If no related package exists, you cannot compile and install it. Due to the large number of packages, you can run the following command to open the Add/delete menu and install the complete gcc environment.
Root@www.linuxidc.com/] #System-config-packages# Open the Add/delete menu
2. Solution CompressionSource code package Root@www.linuxidc.comUsr] #Tar zxvf Httpd-2.2.19.tar.gz # Use t Ar commandProceed ExtractIf the suffix is .tar.bz2, decompress it using the jxvf parameter.
3. perform configuration before compilation./configure Root@www.linuxidc.comHttpd-2.2.19 ] #./Configure -- prefix =/usr/Local/apache# Use the./configure command for pre-compilation Configuration 4. Compile the source code to makeRoot@www.linuxidc.com Httpd-2.2.19] # Make # Use make to compile source code 5. Install the compiled application to the system.Root@www.linuxidc.com Httpd-2.2.19] # Make install # Use make install to install the compiled program to the System
6. modify the configuration file
Vi/usr/local/apache/conf/httpd. conf
Find the row ServerName and remove the comment above.
7. Start apache
/Usr/local/apache/bin/ Apachectl
Check whether startup is enabled
Ps aux | grep 'httpd'
8. Register apache as a system service and start it on startup

There are two ways to enable Apache to automatically start when the system starts.

1. Add the command to start apache in/etc/rc. d/rc. local, for example,/usr/local/httpd/bin/apachectl start.

2. Register apache as a system service

First, copy the apachectl command to the/etc/rc. d/init. d directory and change it to httpd.

Open the httpd file in the editor and go to the first line #! Add the following two lines of text under/bin/sh (required; otherwise, httpd is not supportedChkconfig)

# Chkconfig: 35 70 30
# Description: Apache

Register the service

Chkconfig --DdHttpd

Everything is okay. Start the service.

Service httpd start

The first three numbers in the second row indicate that apache is started under runtime Level 3 and 5, and the second and third indicate the priority configuration of startup and stop, which is irrelevant.

Appendix:

The compiled httpd does not support the chkconfig solution.

When you use chkconfig to Set Self-compilation as a system service, the httpd service does not support chkconfig.

The solution is as follows:

1. edit/etc/init. d/httpd

#! /Bin/bash
# Chkconfig: 345 61 61

# Description: Apache httpd

(Haha, it seems that there is a problem with copying and pasting. manually enter it)

2. Configuration

Root@www.linuxidc.com ~ # Chkconfig -- add httpd
Root@www.linuxidc.com ~ # Chkconfig -- list | grep httpd

Httpd 0: Close 1: Close 2: Close 3: Close 4: Close 5: Close 6: Close

Root@www.linuxidc.com ~ # Chkconfig -- level 345 httpd on
Root@www.linuxidc.com ~ # Chkconfig -- list | grep httpd

Httpd 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: Disable

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.