Linux + Apache + PHP Environment setup

Source: Internet
Author: User

Build the Environment:

Ubuntu 15.04

Apache 2.4.16

PHP 5.6.15

1 Installing Apache

Install dependent programs (all installed in the/usr/local/directory)

Apr-1.5.2.tar.gz http://apr.apache.org/download.cgi

Apr-util-1.5.4.tar.gz

Pcre-8.37.tar.gz http://www.pcre.org/

Then install Apache

Httpd-2.4.16.tar.gz Http://httpd.apache.org/download.cgi#apache24

./configure--prefix=/usr/local/apache2/--with-apr=/usr/local/apr/--with-apr-util=/usr/local/apr-util/-- With-pcre=/usr/local/pcre/

2 Installing PHP

You may need to install LIBXML2 and Libxml2-dev First, apt-get command installation

Install PHP http://php.net/downloads.php

./configure--prefix=/usr/local/php5--with-apxs2=/usr/local/apache2/bin/apxs--with-config-file-path=/usr/ Local/php5/etc

Configuration file: sudo cp Php.ini-production/usr/local/php5/etc/php.ini

    

3 Configuring Apache

Enables Apache to parse PHP scripts

sudo vi/usr/local/apache2/conf/httpd.conf

Add to:

addtype application/x-httpd-php. php. phtml

Optional:

LoadModule Php5_module modules/libphp5.so #安装php时候自动添加的

DirectoryIndex index.php index.html #默认打开文件名

DocumentRoot "/usr/local/apache2/htdocs" #默认脚本存放目录, can be modified, and the following <directory "..." > Synchronous modification

4 Testing

Create a info.php file in the/usr/local/apache2/htdocs/directory

<? PHP     Phpinfo ();? >

Open Apache Service Sudo/usr/local/apache2/bin/apachectl start

Browser input localhost/info.php appears in PHP information page, indicating that the configuration is successful ~

    

 

Linux + Apache + PHP Environment setup

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.