Two ways to install PHP extensions for CentOS

Source: Internet
Author: User

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Directory (?) [+]

To view the PHP version:

-v
    • 1
    • 1

To view the specified PHP version:

/usr/local/php/bin/php -v
    • 1
    • 1

See the extensions that PHP has installed

-m
    • 1
    • 1

View a version of PHP installed extensions on the server

/usr/local/php/bin/php -m
    • 1
    • 1

See the location of php.ini

/usr/local/php/bin/php --ini
    • 1
    • 1
Install extensionsMethod One: Install with the yum command

If PHP is installed with the Yum command, the extension can also be installed via Yum
Perform the following three steps, in which the input content is required to perform a "carriage return":

1、命令行运行yum install  libevent-devel2、命令行运行pecl install channel://pecl.php.net/libevent-0.1.03、命令行运行echo extension=libevent.so > /etc/php.d/libevent.ini
    • 1
    • 2
    • 3
    • 1
    • 2
    • 3

In the above steps, you need to install PECL, if not, the following is the installation method:

    //打开对应安装版本目录cd /usr/local/php/bin/    //curl下载 curl -o go-pear.php http://pear.php.net/go-pear.phar //安装php go-pear.php
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
Method Two: Phpize installation
    Download libevent extension file compression package (in the current system which directory download random) ~# wget http:Pecl.php.net/get/libevent-0.1.0.tgzExtract Files ~# TAR-ZXVF libevent-0.1. 0.tgz/ /Enter the source directory ~# cd libevent-0.1. 0/ //Run phpize command, write full phpize path ~#/usr/local/php/bin/phpize //Run Configure command, configure the path to the php-config to attach ~#./configure--with-php-config=/ Usr/local/php/bin/php-config //Run make command ~# make //test Compile Install ~# Make Test //Formal Compile install ~# sudo make Install /Modify php.ini, end add: extension=libevent.so //restart corresponding PHP-FPM      

Two ways to install PHP extensions for CentOS

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.