Ubuntu 14.04 compiler installs Apache and PHP

Source: Internet
Author: User
Tags file info php source code

First install Apache.

Download the source package and extract it into the/usr/local/directory.

Also download the other packages on which it depends: Apr apr-util pcre, also extract it into the/usr/local/directory.

The directory is then established apache2 Apr apr-util pcre as the installation directory.

Next, follow the dependencies, first install Apr: to the source code extract directory Execution (1)./configure--PREFIX=/USR/LOCAL/APR (2) make (3) make install

Reinstall Apr-util: To the source Code decompression directory Execution (1)./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR (2) make (3) make instal L

Then install Pcre, you will encounter problems, error "you need a C + + compiler for C + + support." The Ubuntu default does not provide C + + compiler environment, first executes Apt-get install build-essential, then compiles installs: executes under the source Code decompression directory (1)./configure--prefix=/usr/local/ Pcre (2) make (3) make install

At this point, then to install Apache, otherwise it will be an error: to the source Code decompression directory implementation (1)./configure--prefix=/usr/local/apache2--WITH-APR=/USR/LOCAL/APR-- With-apr-util=/usr/local/apr-util--with-pcre=/usr/local/pcre (2) make (3) make install

Then enter the installation directory of the Conf directory to modify the configuration file (the canonical practice is to back up) VI httpd.conf

Among them, find:
AddType application/x-compress. Z
AddType application/x-gzip. GZ tgz
To add later:
AddType application/x-httpd-php. PHP (make Apcche support PHP)
AddType Application/x-httpd-php-source. php5

Found it:
<ifmodule dir_module>
DirectoryIndex index.html
</IfModule>
To
<ifmodule dir_module>
DirectoryIndex index.html index.php
</IfModule>

Found it:
#servername www.example.com:80
Modified to:
ServerName 127.0.0.1:80 or ServerName localhost:80
Remember to remove the "#" in front.

At this point, the Apache installation is complete and executed in the bin directory of the installation directory./apachectl-k start starts Apache (./apachectl-k stop;./apachectl-k restart restart), open Web page loc ALHOST:80 test, the It Works page appears, the test is successful.


Start installing PHP below

Download the PHP source code, extract into the/usr/local/directory, and in the directory to establish PHP5 as the installation directory.

Before compiling the installation, you must first perform

Apt-get Install LIBXML2

Apt-get Install Libxml2-dev

Update (install) LIBXML2, otherwise the return is wrong.

Then compile the installation: to the source code to extract the directory Execution (1)./configure--prefix=/usr/local/php5--with-apxs2=/usr/local/apache2/bin/apxs (2) make (3) Test (4) make install

Then add the configuration file: Cp/usr/local/php-5.4.31/php.ini-development/usr/local/php5/lib/php.ini

Restart Apache, add File info.php under the Htdocs of Apache's default publishing root directory.

Content is:

<?php
Phpinfo ();
?>

Open the page localhost/info.php, see the Promotion Information page, test installation successful, installation completed.


References to predecessors articles:

Http://www.cnblogs.com/lufangtao/archive/2012/12/30/2839679.html

http://www.xiaolangspace.com/archives/159

Http://www.linuxidc.com/Linux/2009-08/21341.htm

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.