Multiple PHP Installation extension methods

Source: Internet
Author: User
PHP has a variety of ways to install and expand, mainly the package management of Yum installation, PECL installation, as well as the underlying source code compilation installation.

Package management of the safety loading and unloading is particularly convenient, and the source code compiled installation is convenient parameter tuning.

General construction of the local development environment recommended package management installation, save time. While the online deployment environment is recommended for compiling and installing, it is convenient for tuning.


Yum Installation

# # Yum installation can automatically install the expanded. So dynamic library and configure the php.ini# such as install MySQL expand yum search mysql|grep php  #我们搜索到拓展名为 php-mysql.x86_64sudo Yum Install Php-mysql  #这样php-mysql Expansion Installed # If there is an extended version and a PHP version conflict problem, You can install any of the following Yum sources: atomic-release.noarchwebtatic-release.noarch# These sources provide additional versions of PHP extensions, while each source provides multiple versions for a specific extension, you only need to install one source. Such as: Atomic source can search to 5.4 version of the MySQL extension  atomic-php54-php-mysql.x86_64 webtatic source can search to 5.5 version of the MySQL expansion php55w-mysql.x86_64


PECL Installation

# We need to download the Go-pear tool from Pear Official website # This tool will help us install the PECL Package Manager (manage php C extension) Pear Package Manager (Manage PHP class library) wget http://pear.php.net/go-pear.phar# Installation Tool # installation process unless specifically specified, the tool is installed by default in the/home/user name/pear/bin directory PHP go-pear.phar# Add a tool directory to the environment variable # edit/etc/profile append a line configuration export path=$ path:/home/User name/pear/bin# load environment Configuration source/etc/profile# Configuration Tool php_ini option, so the PECL tool can help us automatically configure the php.ini file when installation is expanded # vim/home/user name/ pear/share/pear/pear/config.php# search Php_ini, default key modified to your php.ini file path:        ' php_ini ' = = Array (            ' type ' = ' = ') File ',            ' default ' = '/etc/php.ini ',            ' doc ' = ' location of php.ini in which to enable PECL extensions on Inst All ',            ' prompt ' = ' php.ini location ',            ' group ' = ' File Locations (Advanced) ',   #确认一下, configure the effect pecl Config-get Php_ini  #配置成功将显示/etc/php.ini# search mysql extension pecl Searches mysql# This is usually prompted to update the tool, we are prompted to update sudo pecl Channel-update pecl.php.net# search MySQL extension again, successful PECL search mysql# installation extension pecl install  MySQL


Source Code Compilation Installation

# description, next add # Download extension source, enter the source directory, execute phpize instructions to generate compile configuration file Configure detection script, # Execute configure script with parameters to generate compilation configuration file makefile# make & make I Nstall Vivid This Extended dynamic library # Migration generated by the extended dynamic library. So file to PHP.ini in the configured Extension_dir # php.ini Add a section area the extended configuration information



Check MySQL expansion for installation success

Php-i | grep MySQL

After successful installation, the above command will display the MySQL extension status information for a section area.

But expanding into the running environment also requires you to restart the Web service or php-fpm

  • 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.