Configuration of the PHP development environment (Apache and PHP installed on Linux platforms)

Source: Internet
Author: User
Tags php development environment

configuration of the PHP development environment ( Apache and php installed on Linux platforms ):

Download apache  (httpd-2.4.12.tar.gz) , download php (php-5.6.9.tar.gz) , download and php Installation related LIBXML2 (libxml2-2.7.8.tar.gz) , download and apache Installation related three files: APR (apr-1.5.2.tar.gz) , apr-util (apr-util-1.5.4.tar.gz) , pcre  (pcre-8.10.zip)

(1) Install Apache: Before installing Apache, You must install Apr,apr-util , and pcre, otherwise there will be an error:

Install Apr:

Gunzip apr-1.5.2.tar.gz

Tar XVF Apr-1.5.2.tar

Go to the apr-1.5.2 directory and execute:

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

Make && make install

Install Apr-util:

After decompression, go to the Apr-util directory and execute:

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

M Ake && make install

Install Pcre: GCC must be installed prior to installation, otherwise the Pcre file cannot be compiled

Installing gcc:yum-y Install gcc+ gcc-c++

Then install Pcre:

After decompression, go to the Pcre directory and execute:

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

M ake && make install

after installing these files, you can install Apache, unzip the httpd-2.4.12.tar.gz:

Gunzip httpd-2.4.12.tar.gz

Tar XVF Httpd-2.4.12.tar

Go to unzip directory:CD httpd-2.4.12, then execute:

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

--with-pcre=/usr/local/pcre

Make && make install

(2) Install PHP:

Install libxml2before installing PHP:

After decompression go to directory:libxml2-2.7.8, then execute:

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

Make && make install

Install PHP: Unzip and go to directory php-5.6.9, then execute:

./configure--prefix=/usr/local/php--WITH-LIBXML-DIR=/USR/LOCAL/LIBXML2--with-apxs2=/usr/local/apache/bin/apxs

Make && make install

After installing PHP, copy the php.ini-development from the extracted php-5.6.9 directory to the following directory:

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

(3) Configure the httpd-confin the Apache conf folder to add the following (if not present):

Add LoadModule php5_module module/libphp5.so at LoadModule

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

(4) Start or restart Apache:

/usr/local/apache/bin/apachectl Restart ( or start)

(5) test whether Apache and PHP are installed correctly:

Into the htdocs directory inside Apache,

[Email protected] htdocs]# vim hello.php

<?php

echo "Hello world!";

Phpinfo ();

?>

In the browser input:http://172.16.2.42/hello.php ( the IP address of my Linux host is 172.16.2.42, through remote access), the successful access is shown as follows:


Configuration of the PHP development environment (Apache and PHP installed on Linux platforms)

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.