Linux installation methods for configuring the PHP environment

Source: Internet
Author: User
Tags php programming

The examples in this article describe how Linux installs the PHP environment. Share to everyone for your reference, as follows:

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

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

2. Installing LIBXML2

Copy CodeThe 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

If the installation succeeds, the bin, include, Lib, man, and share five directories will be generated under the/usr/local/libxml2/directory. When you install the configuration of the PHP5 source package later, you specify the location where the LIBXML2 library files are installed by adding the "--with-libxml-dir=/usr/local/libxml2" option in the options for the Configure command.

3. Installing PHP5

Copy CodeThe 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 let him support PHP

① configuration httpd.conf let Apache support PHP:

Copy CodeThe code looks like this: # vi/usr/local/apache/conf/httpd.conf

Locate AddType application/x-gzip. gz. tgz below to add the following

AddType application/x-httpd-php. PHP (with spaces in front)

AddType Application/x-httpd-php-source. PHPS (front with spaces)

② then cpopy the PHP configuration file

Copy CodeThe code is as follows: CP Php-5.3.8/php.ini.dist/usr/local/php/lib/php.ini

(If there is no php.ini.dist, rename any one of the php.ini-development php.ini-production to Php.ini.dist.) )

Modify the php.ini file

Copy CodeThe code is as follows: Register_globals = On

③ Restart Apache

Copy CodeThe code is as follows: Service Apache restart

5. Test if PHP is installed successfully

Write a PHP test page info.php, and put it in Apache2/htdocs.

123 <?php phpinfo();?>

Enter in Browser: server address/info.php

If the PHP information can be displayed correctly, the apche+mysql+php installation is successful!

I hope this article is helpful to you in PHP programming.

Linux installation methods for configuring the PHP environment

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.