CentOS Server compiled and installed apache+php

Source: Internet
Author: User

1, Check whether the server comes with httpd, if/etc/httpd/httpd.conf, the system comes with httpd service, need to uninstall or shut down the service, do not let him affect the installation of the service start

Service httpd status can be viewed

2. Stop services: Service httpd stop

3, uninstall httpd:

View HTTPD Process Pid:ps-ef | grep httpd

End process: Kill PID Number (all to end)

Find HTTPD installation package: Rpm-qa |grep httpd

Uninstalling the installation package: RPM-E HTTPD Package

4. Download and install httpd

Note: Install Apache: You must install APR, Apr-util, and pcre before installing Apache, or you will get an error

  4.1. Install Apr:

Tar zxvf Apr-1.5.2.tar

Go to the apr-1.5.2 directory and execute:

./configure--PREFIX=/USR/LOCAL/APR

Make && make install

If no acceptable C compiler found in $PATH, that is because there is no GCC compiler environment

Execute yum-y Install gcc+ gcc-c++

  4.2, installation Apr-util:

 Tar zxvf apr-util-1.5.4.tar.gz
Enter the extracted directory

./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/bin/apr-1-config

Make && make install

  4.3, installation Pcre

TAR-ZXVF pcre-8.39.tar.gz

Enter the extracted directory

./configure--prefix=/usr/local/pcre

Make && make install

  4.4 Installing Apache

Tar zxvf httpd-2.4.23.tar.gz

Enter the extracted directory

./configure--prefix=/usr/local/apache--enable-so--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util-- With-pcre=/usr/local/pcre

5. Install PHP

  5.1, first install the dependency package LIBXML2

Tar zxvf libxml2-2.8.0.tar.gz, enter the extracted directory

./configure--PREFIX=/USR/LOCAL/LIBXML2

Make && make install

5.2 Installing PHP

Tar zxvf php-5.6.25.tar.gz

./configure--prefix=/usr/local/php--with-config-file-path=/usr/local/php/etc--with-libxml-dir=/usr/local/ LIBXML2--with-apxs2=/usr/local/apache/bin/apxs--enable-inline-optimization--enable-shared--enable-opcache-- ENABLE-FPM--enable-bcmath--enable-soap--enable-pcntl--enable-shmop--enable-sysvmsg--enable-sysvsem-- Enable-sysvshm--enable-sockets--enable-zip

Make && make install

After the installation is successful

CP Php.ini-development/usr/local/php/etc/php.ini

The directory where php.ini is compiled is the directory that is set at compile time:--with-config-file-path=/usr/local/php/etc

6. Modify Apache Configuration

Vim/usr/local/apache/conf/httpd.conf

Find ServerName, remove the previous # and change the back to localhost:80

LoadModule Add LoadModule php5_module module/libphp5.so (general will have, if not added)

Add AddType application/x-httpd-php at AddType application. php

Exit Save, Esc->:->wq

Restart Apache,/usr/local/apache/bin/apachectl restart

  

  

  

  

  

CentOS Server compiled and installed apache+php

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.