Linux下為PHP添加擴充庫,linuxphp擴充庫

來源:互聯網
上載者:User

Linux下為PHP添加擴充庫,linuxphp擴充庫

例子:添加mbstring擴充庫

1. 進入PHP源碼目錄(沒有源碼的可以先用命令:# php -v 查看版本號碼,然後上PHP官網下載源碼)

2. 進入PHPi源碼下的FTP擴充庫的目錄:

# cd [Your PHP Source Folder]/ext/mbstring

3. 使用 phpize 命令組建組態檔案:

# phpize

4. 執行configure:

# ./configure --with-php-config=/usr/local/php/bin/php-config  (後面的路徑要對應上原生php目錄的php-config)

5. 沒有報錯的話,執行make:

# make

6. make成功後,產生的擴充庫檔案在目前的目錄的 modules 子目錄下,如本例則是mbstring.so,將此檔案copy到“/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/” 下(對應原生PHP目錄)

7. 修改/etc/php.ini,在[mbstring]下添加一行:extension=mbstring.so,儲存

8. 重啟apache或nginx伺服器(如果有用到amh面板的話,還需要使用命令才會生效:# amh php stop [Your Host] 和 # amh php start [Your Host])


在linux下,為php增加mbstring擴充,助

一、確認你所改的php.ini是當前的配置。可以用phpinfo()函數查出來。
二、進入extension_dir所指的目錄,看看有沒有mbstring.so檔案。
三、重啟伺服器(如果是apache 可以用 /etc/init.d/httpd restart)。
 
linux系統下怎安裝oci8的php擴充?

Linux下PHP Oracle用戶端擴充功能(OCI8)安裝
因為最近的項目需要用php訪問oracle資料庫,不得不在linux下給php安裝oci8擴充。php也可以使用pdo訪問oracle資料庫,但還是需要安裝用戶端。參考張宴部落格的這篇文章,出了很多問題,多次嘗試,足夠折騰才安裝成功。首先到oracle官網的這個頁面下載相關的檔案,注意要連資料庫伺服器的版本,一定要對應,否則安裝成功也會連不上,同時也要區分32位、64位伺服器,比如我要連的資料庫伺服器是oracle10.2.0.4,64位主機,那麼我要下載下面三個檔案:oracle-instantclient-basic-10.2.0.4-1.x86_64.rpmoracle-instantclient-devel-10.2.0.4-1.x86_64.rpmoracle-instantclient-sqlplus-10.2.0.4-1.x86_64.rpm用以下命令安裝rpm -ivh oracle-instantclient-basic-10.2.0.4-1.x86_64.rpm oracle-instantclient-devel-10.2.0.4-1.x86_64.rpm oracle-instantclient-sqlplus-10.2.0.4-1.x86_64.rpm再安裝OCI8 PHP擴充yum install libaio
wget pecl.php.net/get/oci8-1.3.5.tgz
tar zxvf oci8-1.3.5.tgz
cd oci8-1.3.5/
/home/renjun/php/bin/phpize CFLAGS="-I/usr/include/oracle/10.2.0.4/client64/" CXXFLAGS="-I/usr/include/oracle/10.2.0.4/client64/"
./configure --with-php-config=/home/renjun/php/bin/php-config --with-oci8=/usr/lib/oracle/10.2.0.4/client64/上面橙色的表示php的安裝路徑,紅色的表示oracle路徑,oracle路徑會因為版本的不同檔案夾名稱有所不同,要到相應目錄查看一下,確認路徑正確。然後執行make,如果報錯,就執行./configure --with-php-config=/home/renjun/php/bin/php-config --with-oci8=instantclient,/usr/lib/oracle/10.2.0.4/client64/lib/成功後會提示你執行make test,那就執行吧,可能會出現一堆的fail,但是不要緊。繼續make install。修......餘下全文>>
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.