已經安裝php後,再增加擴充模組(不重新編輯php)

來源:互聯網
上載者:User

標籤:http   io   ar   os   sp   on   檔案   bs   代碼   

  下面以安裝curl為例,介紹具體安裝步驟。

    1.安裝crul wget http://curl.haxx.se/download/curl-7.19.6.tar.gz tar -zxvf curl-7.19.6.tar.gz cd curl-7.19.6 ./configure --prefix=/usr/local/curl

    make

    make install

    2.編譯產生擴充進入php來源程式目錄中的ext目錄中,這裡存放著各個擴充模組的原始碼,選擇你需要的模組,比如curl模組:

    cd curl

    執行phpize產生編譯檔案,phpize在PHP安裝目錄的bin目錄下

    /usr/local/php5/bin/phpize

    運行時,可能會報錯:Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.“,需要安裝autoconf:

    yum install autoconf(RedHat或者CentOS)、apt-get install autoconf(Ubuntu Linux)

    組建組態檔案,並編譯產生模組:

    /usr/local/php5/bin/phpize

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

    make

    make install

    這樣,curl.so就被複製到PHP對應目錄(如:/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/)

    3.修改配置在php.ini裡,設定擴充目錄:

    extension_dir = "/usr/local/php5/lib/php/extensions/no-debug-non-zts-20090626/"

    並添加擴充模組引用:

    extension = curl.so

    4.檢查並重啟Apache

    /usr/local/php/bin/php -v

    執行這個命令時,php會去檢查設定檔是否正確,如果有配置錯誤,這裡會報錯,可以根據錯誤資訊去排查

已經安裝php後,再增加擴充模組(不重新編輯php)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.