81.LAMP,PHP5 and PHP7 Installation

Source: Internet
Author: User
Tags soap mcrypt

PHP description

PHP (foreign name: Php:hypertext Preprocessor, Chinese name: "Hypertext Preprocessor") is a common open source scripting language. The grammar absorbs the C language, Java and Perl features, is conducive to learning, widely used, mainly for the field of web development. PHP's unique syntax mixes the syntax of C, Java, Perl, and PHP's own creation. It can execute Dynamic Web pages more quickly than CGI or Perl. Dynamic pages made in PHP are compared to other programming languages, and PHP is executed in HTML (an application under the standard Universal Markup Language), which is much more efficient than CGI, which generates HTML markup entirely; PHP can also execute post-compilation code, Compilation can achieve encryption and optimize code execution, making code run faster.

PHP official website

http://php.net/

Version information

PHP5. 6

Get address

wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2

Install PHP parameters
–prefix=/usr/local/php  PS:指定的安装目录; –with-apxs2=/usr/local/apache2.4/bin/apxs PS:该文件是Apache的一个工具,可以将扩展模块添加到Apache的module文件; –with-config-file-path=/usr/local/php/etc PS:指定配置文件所在路径; –with-mysql=/usr/local/mysql  PS:指定mysql的路径; PHP7之前的版本所用的路径–with-mysqli=/usr/local/mysql/bin/mysql_config       –with-pdo-mysql=/usr/local/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config PS:上面两项参数是指定相关mysql库 –with-libxml-dir –with-gd –with-jpeg-dir –with-png-dir –with-freetype-dir –with-iconv-dir –with-zlib-dir –with-bz2 –with-openssl –with-mcrypt –enable-soap –enable-gd-native-ttf –enable-mbstring –enable-sockets –enable-exif一:PHP需支持的插件注:如果在编译过程中遇到错误的话 根据 提示进行安装插件       查找插件的方法  如:yum list |grep xxxxx
PS: Install the following plugins

Yum Install-y libxml2-devel
Yum Install-y openssl-devel
Yum Install-y bzip2-devel
Yum Install-y libjpeg-devel
Yum Install-y libpng-devel
Yum Install-y freetype-devel
Yum Install-y libmcrypt-devel
PS: If you cannot install libmcrypt-devel directly through Yum, install the extension source yum install Epel-release
In the installation

Second: Download and unzip the installation package

[Email protected] src]# wget http://cn2.php.net/distributions/php-5.6.30.tar.bz2
[Email protected] src]# tar jxvf php-5.6.30.tar.bz2

Three: Installation

[Email protected] php-5.6.30]#/configure--prefix=/usr/local/php--WITH-APXS2=/USR/LOCAL/APACHE2.4/BIN/APXS-- With-config-file-path=/usr/local/php/etc--with-mysql=/usr/local/mysql--with-pdo-mysql=/usr/local/mysql-- With-mysqli=/usr/local/mysql/bin/mysql_config--with-libxml-dir--with-gd--with-jpeg-dir--with-png-dir-- With-freetype-dir--with-iconv-dir--with-zlib-dir--with-bz2--with-openssl--with-mcrypt--enable-soap-- Enable-gd-native-ttf--enable-mbstring--enable-sockets--enable-exif

PS: If the prompt is incorrect, install the plugin according to the prompts is often caused by the lack of a plug-in
The initialization succeeds when the following prompt appears

Generating files
Configure:creating./config.status
Creating MAIN/INTERNAL_FUNCTIONS.C
Creating MAIN/INTERNAL_FUNCTIONS_CLI.C
+--------------------------------------------------------------------+
| License: |
| This software was subject to the PHP License, available in this |
| Distribution in the file LICENSE. By continuing this installation |
| Process, you is bound by the terms of this License agreement. |
| If you don't agree with the terms of this license, you must abort |
| The installation process at this point. |
+--------------------------------------------------------------------+

PS: It is possible to compile the next step
[[email protected] php-5.6.30]# make
[[email protected] php-5.6.30]# echo $?
0
[[email protected] php-5.6.30]# make install
[[email protected] php-5.6.30]# echo $?
0

Four: CP configuration file

[email protected] php-5.6.30]# CP php.ini-
Php.ini-development php.ini-production
[email protected] php-5.6.30]# CP Php.ini-production/usr/local/php/etc/php.ini// Using php.ini-production under normal conditions, the development environment can use php.ini-development

Five: Check whether PHP can be used properly

[Email protected]/]# cat/usr/local/apache2.4/conf/httpd.conf |grep php
LoadModule Php5_module modules/libphp5.so
[Email protected]/]#

PHP7 installation Process

The installation process is the same as the PHP5 installation process
Apache servers can have 2 versions of PHP, and close a version of the PHP module by commenting out the corresponding lines in the Apache configuration file.
[Email protected]/]# vim/usr/local/apache2/conf/httpd.conf

If you do not want to use a version of PHP directly in front add # can

81.LAMP,PHP5 and PHP7 Installation

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.