Procedure for building a php development environment in Linux. This document describes how to install the software/development environment by compiling! Background: This document describes how to install the software/development environment by compiling and installing php and Apache. other installation methods are ignored!
Background:
Php and Apache use the compilation and installation methods. However, the compilation and installation methods require the c and c ++ compiling environments,
Install build-essential in apt mode
$ Sudo apt-get install build-essential
Compilation and installation steps are generally divided:
Compile configuration
$./Configure -- XXX (parameter s)
Compilation configuration problems:
A. You cannot fully understand the software before installation.
B. If you do not fully understand how to install it (with which parameters)
C. You can first select the simplest installation method. Multiple installation times will solve this problem.
This process is complex and requires complicated configuration of specific parameters. for specific parameters, see configure -- help.
Compile
$ Make
Install
$ Sudo make install
**************************************
Install Apache
1. download httpd-2.2.11.tar.gz
2. decompress
Tar zxvf httpd-2.2.11.tar.gz
A httpd-2.2.11 directory is generated under the path where the tar command is executed
3. check the compiled configuration information.
Switch to the unzipped httpd-2.2.11 Directory
./Configure -- help
Through this step, you can understand the modules that can be installed and the installation configuration information needs to be set.
For more information, see the manual.
4. Compile and configure
$./Configure -- prefix =/usr/local/apache2 \ specify the installation directory
-- Enable-so \ allow external so Module
-- With-mpm = prefork url request jump policy
5. Compile:
$ Make
6. Installation: (use sudo because the path to be installed/usr/local/apache2 is not in the personal path)
$ Sudo make install
Installation complete
7. test
Modify httpd. conf.
Change # ServerName www.example.com: 80 to ServerName 127.0.0.1: 80 (localhost: 80)
Start sudo./apachectl-k start
Stop sudo./apachectl-k stop
Restart sudo./apachectl-k restart (this command is sometimes invalid and should be replaced by stop + start)
****************************************
PHP installation
1. download php-5.2.8.tar.gz
2. decompress tar zxvf php-5.2.8.tar.gz
3. check the compiled configuration information.
Switch to the unzipped httpd-2.2.11 Directory
./Configure -- help
Through this step, you can understand the modules that can be installed and the installation configuration information needs to be set.
For more information, see the manual.
4. Compile the configuration
./Configure -- prefix =/home/guandl/webenv/php528 \
-- Enable-mbstring \
-- With-apxs2 =/usr/local/apache2/bin/apxs
5. Compile
Make
6. Installation
Sudo make install
Installation complete
7. copy php. ini
Because the php directory $ php/lib after installation does not have a php configuration file, you need to copy the php. ini-recommended directory under the decompressed directory to the php lib directory.
Sudo cp php. ini-recommended/home/guandl/webenv/php528/lib/php. ini
8. modify the configuration file httpd. conf of apache.
Add content
LoadModule php5_module modules/libphp5.so is automatically generated when you install php.
AddType application/x-httpd-php. php
9. test
Compile a php file, such as any. php.
Phpinfo ();
?>
Put it in the apache htdocs Directory
Restart apache
Http: // 127.0.0.1/any. php
Success! Background: php, Apache, and other installation methods are used for installation...