【问题标题】:Installing pecl_http in xubuntu在 xubuntu 中安装 pecl_http
【发布时间】:2010-12-28 09:15:31
【问题描述】:

根据标题,我只是想在 ubuntu 中为 php 安装 pecl_http 扩展。

所以我做了最有意义的事情:

andreas@earl ~ $ sudo pecl install pecl_http
downloading pecl_http-1.6.6.tgz ...
Starting to download pecl_http-1.6.6.tgz (173,645 bytes)
.....................................done: 173,645 bytes
71 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
 1. whether to enable cURL HTTP requests; specify libcurl directory : yes

1-1, 'all', 'abort', or Enter to continue: 
 1. whether to enable support for gzencoded/deflated message bodies; specify zlib directory : yes

1-1, 'all', 'abort', or Enter to continue: 
 1. whether to enable response content type guessing; specify libmagic directory : no

1-1, 'all', 'abort', or Enter to continue: 
 1. whether to depend on extensions which have been built shared : yes

1-1, 'all', 'abort', or Enter to continue: 
building in /var/tmp/pear-build-root/pecl_http-1.6.6
running: /tmp/pear/temp/pecl_http/configure --with-http-curl-requests --with-http-zlib-compression --with-http-magic-mime=no --with-http-shared-deps

checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc

.... <snip>

checking for unistd.h... (cached) yes
checking for gethostname... yes
checking for getdomainname... yes
checking for getservbyport... yes
checking for getservbyname... yes
checking for zlib.h... found in /usr
checking for zlib version >= 1.2.0.4... 1.2.3.3
checking for curl/curl.h... not found
configure: error: could not find curl/curl.h
ERROR: `/tmp/pear/temp/pecl_http/configure --with-http-curl-requests --with-http-zlib-compression --with-http-magic-mime=no --with-http-shared-deps' failed

好吧,我的系统中没有 curl,所以我有

andreas@earl ~ $ sudo apt-get install php5-curl

Curl 安装正常,所以我再次尝试安装 php5-http,但仍然是同样的错误。

有人可以分享一盏灯吗? :(

-哇

【问题讨论】:

    标签: php http pecl


    【解决方案1】:

    您收到的消息并不表示 PHP curl 包丢失。

    相反,问题在于您似乎没有“系统” curl 包——或者,至少在其“开发”版本中没有,其中包含编译 pecl_http 所需的文件。

    从快速apt-cache search 判断:

    $ LANG=en apt-cache search libcurl dev
    libcurl4-gnutls-dev - Development files and documentation for libcurl (GnuTLS)
    libcurl4-openssl-dev - Development files and documentation for libcurl (OpenSSL)
    ...
    

    您可能必须安装libcurl4-gnutls-devlibcurl4-openssl-dev
    (上次编译 PHP 时,我安装了第一个,它允许我在启用 curl 支持的情况下编译 PHP)

    【讨论】:

      【解决方案2】:

      或者.. 只需sudo apt-get install libcurl3-dev 将提供curl/curl.h 并且您的pecl_http 安装将继续

      【讨论】:

        【解决方案3】:

        晚了,但这解决了我在 Ubuntu 13.04 上的问题:

        sudo apt-get install -y curl libcurl3 libcurl4-gnutls-dev libmagic-dev 然后sudo pecl install pecl_http

        致谢:http://web.onassar.com/blog/2012/07/15/installing-pecl-http-package-on-ubuntu-11-10/

        【讨论】:

          【解决方案4】:

          这适用于我的 Ubuntu 12.10

          sudo apt-get install libcurl3-openssl-dev
          sudo pecl install -a pecl_http
          
          sudo sh -c "echo 'extension=http.so' > /etc/php5/mods-available/http.ini"
          sudo ln -s /etc/php5/mods-available/http.ini /etc/php5/conf.d/
          

          您需要重新启动您的网络服务器,才能加载此模块。

          sudo service apache2 restart
          or
          sudo service nginx restart
          

          【讨论】:

            猜你喜欢
            • 2015-06-24
            • 2011-05-15
            • 2016-02-01
            • 2014-11-11
            • 2015-10-03
            • 1970-01-01
            • 2018-03-04
            • 1970-01-01
            • 2015-03-27
            相关资源
            最近更新 更多