How to install and configure the php environment in Linux

Source: Internet
Author: User
: This article describes how to install and configure the php environment in Linux. if you are interested in the PHP Tutorial, refer to it. This article describes how to install and configure the php environment in Linux. We will share this with you for your reference. The details are as follows:

1. get the installation file: http://www.php.net/downloads.php php-5.3.8.tar.gz

Get the support files required to install php: http://download.csdn.net/download/netlong339/1351852 libxml2-2.6.32.tar.gz

2. install libxml2

The code is as follows:

Tar zxvf libxml2-2.6.32.tar.gz
Cd libxml2-2.6.32
./Configure -- prefix =/usr/local/libxml2
Make
Make install

After the installation is successful, five directories, bin, include, lib, man, and share, will be generated under the/usr/local/libxml2/directory. When you install the PHP5 source code package later, the "-- with-libxml-dir =/usr/local/libxml2" option will be added in the options of the configure command, it is used to specify the location where libxml2 library files are installed.

3. install php5

The code is as follows:

# Tar zvxf php-5.3.8.tar.gz
# Cd php-5.3.8
#./Configure \
-- Prefix =/usr/local/php \
-- With-mysql =/usr/local/mysql \
-- With-apxs =/usr/local/apache2/bin/apxs \
-- Enable-fastcgi \
-- Enable-fpm
# Make
# Make install

4. reconfigure apache2 to support php

① Configure httpd. conf to make apache support PHP:

The code is as follows:

# Vi/usr/local/apache/conf/httpd. conf

Find AddType application/x-gzip. gz. tgz and add the following content under it:

AddType application/x-httpd-php. php (there is a space before)

AddType application/x-httpd-php-source. phps (there is a space before)

② Then the configuration file of CPOPY PHP

The code is as follows:

Cp php-5.3.8/php. ini. dist/usr/local/php/lib/php. ini

(If php. ini. dist is not available, rename any of php. ini-development php. ini-production to php. ini. dist .)

Modify the php. ini file

The code is as follows:

Register_globals = On

③ Restart apache

The code is as follows:

Service apache restart

5. test whether php is successfully installed.

Write a php test page info. php and put it in apache2/htdocs.

<?php phpinfo();?>

Enter the server address/info. php in the browser

If the php information is displayed normally, it indicates that Apche + Mysql + PHP is successfully installed!

I hope this article will help you with PHP programming.

The above describes how to install and configure the php environment in Linux, including some content. if you are interested in the PHP Tutorial, please help.

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.