PHP (foreign name: PHP: Hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. The syntax absorbs the features of C, Java, and Perl, which is easy to learn and widely used and mainly applies to the Web development field. PHP's unique syntax is a mix of C, Java, Perl, and PHP's own syntax. It can execute dynamic web pages more quickly than CGI or Perl. Compared with other programming languages, PHP embeds programs into HTML (an application under the standard general Markup Language) documents for execution, the execution efficiency is much higher than the CGI that completely generates the HTML tag. PHP can also execute the compiled code to encrypt and optimize code execution, so that the code runs faster.
1. Download
: Http://cn2.php.net/distributions/php-5.6.8.tar.gz
II. Installation
Tar xzvf php-5.6.8.tar.gz
Cd php-5.6.8
PHP compilation parameters:
#! /Bin/sh
./Configure \
-- Prefix =/usr/local/php \
-- With-apxs2 =/usr/local/apache2/bin/apxs \
-- With-mysql =/usr/local/mysql \
-- With-pdo-mysql =/usr/local/mysql \
-- With-zlib \
-- With-gd \
-- With-freetype-dir \
-- With-png-dir \
-- With-jpeg-dir \
-- With-mcrypt \
-- Enable-mbstring \
-- Enable-fpm \
-- Disable-debug
Make & make install
III. configuration
Cp php. ini-development/usr/local/php/lib/php. ini
Cd/usr/local/php/etc/
Cp php-fpm.conf.default php-fpm.conf
Sed-I "s/nobody/apache/g" php-fpm.conf
Ln-s/usr/local/php/sbin/php-fpm/usr/sbin/
Note: This function is used with nginx. if it is apache, no configuration is required;
IV. verification
Add an info. php file under the apache web program directory. the content is as follows:
Phpinfo ();
?>
Open your browser and enter http: // ip/info. php in the address bar. if the PHP information is displayed normally;
PHP compilation error solution:
Configure: error: xml2-config not found. Please check your libxml2 installation.
Yum-y install libxml2 libxml2-devel
------------------------------------
Configure: error: Invalid Lib. h not found.
Yum-y install libjpeg-devel
------------------------------------
Configure: error: png. h not found.
Yum-y install libpng-devel
------------------------------------
Configure: error: freetype-config not found.
Yum-y install freetype-devel
------------------------------------
Configure: error: mcrypt. h not found. Please reinstall libmcrypt.
Yum-y install libmcrypt-devel