php插件安装

  1. 新装指定编译时设置,如需要安装curl扩展
    $ cd $PHP_ROOT
    $ ./configure --with-curl
    
  2. 已安装的php,使用phpize
    $ cd $PHP_ROOT/ext/crul
    $ phpize ./configure –with-curl
    

使用composer安装提示存在问题

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested PHP extension ext-curl * is missing from your system. Install or enable PHP's curl extension.
  Problem 2
    - The requested PHP extension ext-gd * is missing from your system. Install or enable PHP's gd extension.
  Problem 3
    - Installation request for upyun/sdk ^3.3 -> satisfiable by upyun/sdk[3.3.0].
    - upyun/sdk 3.3.0 requires ext-curl * -> the requested PHP extension curl is missing from your system.
  Problem 4
    - sabre/dav 3.2.2 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - sabre/dav 3.2.1 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - sabre/dav 3.2.0 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
    - Installation request for sabre/dav ~3.2.0 -> satisfiable by sabre/dav[3.2.0, 3.2.1, 3.2.2].

解决

使用phpize安装 phpize可以在已经安装好php后不进行源码的再次编译安装的情况下进行插件的添加

$ phpize ./configure –with-curl

报错提示:

Cannot find config.m4. 
Make sure that you run '/usr/local/bin/phpize' in the top level source directory of the module

原因为需要进入php的源码安装目录的插件目录中去,如curl模块则需要进入/usr/local/php-5.6.33/ext/curl中执行

 $ cd /usr/local/php-5.6.33/ext/curl
 $ phpize

再次报错:

Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.

解决:

# yum install m4
# yum install autoconf

再继续执行

$ ./configure --with-curl=/usr/local/bin/curl/

提示

checking for cURL in default path... not found
configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/

安装

# yum install curl curl-devel

继续:

$ make install
$ ls modules/curl.so #将路径添加到php.ini中

再在php.ini中添加extension = curl.so

$ php m

参考

  1. 使用phpize增加php模块
  2. phpize 时 Cannot find autoconf 解决方法