PhpforLinux source code compilation and installation and configuration

Source: Internet
Author: User
Tags mcrypt
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

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.