zoukankan      html  css  js  c++  java
  • [Ubuntu] How to add PHP extension after installed PHP?

    Let say you installed PHP and run it for a month, but now you want to use curl in PHP.

    But so bad that you didn't install this extension when you installed PHP. That is to say,

    now you want to add PHP extension.

    Here is an example to install curl extension. 

    apache2 is in /usr/local/apache2 

    php is in /usr/lib/php5/

    1. Install the CURL

    Download the curl source code from: http://curl.haxx.se/download, here is curl-7.17.1.tar.gz.

    Then uncompress and install it.

    tar -zxf curl-7.17.1.tar.gz
    ./configure --prefix=/usr/local/curl
    sudo make
    sudo make test
    sudo make install

    Here we install the curl to /usr/local/curl

    2. Install the php5-curl

    *Note: You should have the php source code, otherwise the steps can't not go on. Assume that the PHP source code

    is in ~/Downloads/php-5.2.10-src, and you should have installed the phpize.

    cd ~/Downloads/php-5.2.10-src/ext/curl/
    phpize
    ./configure --with-php-config=php-config --with-curl=/usr/local/curl
    sudo make
    sudo make test
    sudo make install

    Then you will find curl.so in ~/Downloads/php-5.2.10-src/ext/curl/modules. Copy it to the php extension folder, here is /usr/lib/php5/20060613+lfs/

    sudo cp ~/Downloads/php-5.2.10-src/ext/curl/modules/curl.so /usr/lib/php5/20060613+lfs/curl.so

    3. Modify the php.ini file

    add the code to php.ini

    extension=curl.so

    4. restart the apache

    sudo /etc/init.d/apache2 restart

    Then the curl extension is installed. 

  • 相关阅读:
    Rabbitmq 性能测试
    B+树图文详解
    图的概念和存储(邻接矩阵,邻接表)
    WebApi系列文章
    Asp.Net MVC项目集成Swagger
    正则表达式匹配两个特殊字符中间的内容
    数学常数e的含义
    十大排序算法总结
    C#集合类型大揭秘
    深入System.Web.Caching命名空间 教你Hold住缓存管理(三)
  • 原文地址:https://www.cnblogs.com/davidhhuan/p/2317227.html
Copyright © 2011-2022 走看看