Install and configure the php environment in Linux. How to install and configure the php environment in Linux. how to install and configure the php environment in linux is described in this article. For your reference, refer to the following: 1. obtain the installation method for installing and configuring the php environment in Linux.
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.
Articles you may be interested in:
- Install and configure the Nginx server + PHP development environment from scratch in Linux
- Linux Apache PHP Oracle installation and configuration (procedure)
- Notes on installation and configuration of apache, mysql, and php in linux
- Installation and configuration of lanmp (Linux Apache Nginx Mysql Php)
The following example describes how to install and configure the php environment in Linux. Share it with you for your reference. for details, refer to: 1. get the installation document...