日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

Linux php5 curl 扩展

發布時間:2023/12/14 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Linux php5 curl 扩展 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

方法一

安裝cURL

?

wget?http://curl.haxx.se/download/curl-7.17.1.tar.gz

?tar -zxf curl-7.17.1.tar.gz

./configure --prefix=/usr/local/curl

make & make install

?

安裝php

? ?只要打開開關 --with-curl=/usr/local/curl

? ?就可以了。

? ?這個擴展庫還是非常棒,是fsockopen等等相關的有效的替代品。

?

方法二

進入安裝原php的源碼目錄,

cd ext

cd curl

phpize

?

./configure --with-curl=DIR

make & make install

?

就會在PHPDIR/ext/curl/moudles/下生成curl.so的文件。

復制curl.so文件到extensions的配置目錄,修改php.ini就好了

?

extension=curl.so

?

以上是網上找到的資料,下面是我在安裝過程中遇到的問題,我用的第二個方法,因為我是在現在有的PHP擴展Curl模塊。在phpize時找不到命令,因為我的PHP不是默認安裝在,在lib庫里沒有找到這個命令,要絕對路徑執行phpize

?

?

進入安裝原php的源碼目錄,

cd ext

cd curl

?

#路徑不一定在當前目錄下,去尋找phpize運行。之后會生成了一個configure文件

/usr/local/php-5.3.3/phpize

?

執行完出看到有perl警告提示環境設置失敗,原信息如下:

?

Configuring for:

PHP Api Version: ? ? ? ? 20041225

Zend Module Api No: ? ? ?20060613

Zend Extension Api No: ? 220060519

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

? ? ? ? LANGUAGE = (unset),

? ? ? ? LC_ALL = (unset),

? ? ? ? LANG = "zh_CN.GB2312;zh_CN.UTF-8;en_US;en_US.UTF-8"

? ? are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

? ? ? ? LANGUAGE = (unset),

? ? ? ? LC_ALL = (unset),

? ? ? ? LANG = "zh_CN.GB2312;zh_CN.UTF-8;en_US;en_US.UTF-8"

? ? are supported and installed on your system.

perl: warning: Falling back to the standard locale ("C").

?

?

這個問題解決方法,在profile里加配置,步驟如下:

?

vim /etc/profile

在profile最底加上export LC_ALL=C

?

保存退出

?

執行profile讓它生效

source /etc/profile

?

再執行一次

/usr/local/php-5.3.3/phpize

?

再也沒有警告提示

?

接著往下走,安裝Curl

?

./configure --with-curl=DIR

?

這一步又出現問題,找不到php-conifg配置,加上php-config的路徑:

?

./configure --with-php-php-config=/usr/local/php-5.3.3/bin/php-config --with-curl=DIR

?

make & make install

?

?

會在PHPDIR/lib/php/extensions/下生成curl.so的文件。

復制到extension_dir,修改php.ini

?

extension=curl.so

?

/usr/local/php-5.3.3/bin/php -m?

?

看到了curl 擴展。

?

?

重啟apache 生效。

?

知識補充:

?

phpize的作用可以這樣理解:偵測環境,建立一個configure文件。必須在一個目錄下去運行phpize。那么phpize就知道你的的環境是哪個目錄,并且configure文件建立在該目錄下。

?

假如你的服務器上安裝了多個版本php,那么需要告訴phpize要建立基于哪個版本的擴展。通過使用--with-php-config=指定你使用哪個php版本。

?

比如:--with-php-config=/usr/local/php524/bin/php-config ?

?

php-config文件在是在php編譯生成后(安裝好),安裝目錄下的一個文件。

?

?

?

?

?

?

?

總結

以上是生活随笔為你收集整理的Linux php5 curl 扩展的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。