PHP development environment configuration (install Apache and PHP on Linux) _ PHP Tutorial

Source: Internet
Author: User
Tags php development environment
Configure the PHP development environment (install Apache and PHP on the Linux platform ). Configuration of the PHP development environment (Apache and PHP are installed on the Linux platform) configuration of the PHP development environment (Apache and php are installed on the Linux platform): Download apache(httpd-2.4.12.tar.gz#、php (php-5.6.9.tar. configuration of the PHP development environment (install Apache and PHP on the Linux platform)

Configuration of the PHP development environment (install Apache and php on the Linux platform ):

Download Apache plugin), download Apache installation-related 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: you must install apr, apr-util, and pcre before installing apache. Otherwise, an error occurs:

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:

Decompress the package and enter the apr-util Directory. then run the following command:

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

Make & make install

Install pcre: install gcc before installation; otherwise, the pcre file cannot be compiled.

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

Then install pcre:

Decompress the package and enter the pcre Directory. then execute:

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

Make & make install

After these files are installed, you can install apacheto decompress httpd-2.4.12.tar.gz:

Gunzip httpd-2.4.12.tar.gz

Tar xvf httpd-2.4.12.tar

Go to the extract Directory: cd httpd-2.4.12 and 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 libxml2 before installing php:

Decompress the package and enter the directory: libxml2-2.7.8, and then execute:

./Configure -- prefix =/usr/local/libxml2

Make & make install

Install php: unzip and enter the directory php-5.6.9, and 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 in the unzipped php-5.6.9 directory to the following Directory:

Cp php. ini-development/usr/local/php/lib/php. ini

(3) configure httpd-conf in the conf folder of Apache and add the following content (if it does not exist ):

Add LoadModule php5_module module/libphp5.so to LoadModule

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

(4) start or restart Apache:

/Usr/local/apache/bin/apachectl restart (or start)

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

Go to the htdocs directory in Apache,

[Root @ Masterpc htdocs] # vim hello. php

Echo "Hello world! ";

Phpinfo ();

?>

Enter http: // 172.16.2.42/hello. php in the browser (the IP address of my linux host is 172.16.2.42, which is accessed remotely:

(Install Apache and PHP on Linux) configuration of PHP development environment (install Apache and php on Linux): Download Apache (httpd-2.4.12.tar.gz?、download php(php-5.6.9.tar ....

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.