Linux php5 oci pdo install

來源:互聯網
上載者:User

 

 

1)安裝oracle client相關包

   

   1> 用查看Linux系統:

uname -m

如果看到資訊包含有64,說明你的Linux是64位系統,沒有則是32位的,下載相應的包。我這是64位系統。去(Linux 64位版)http://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html 下載

 

oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm

        oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm

        sdk-11.1.0.7.0-linux-x86_64.zip

 

   2> 安裝

         #預設安裝到/usr/lib/oracle/11.1/client64/下面

 

rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm 

 

         #預設安裝到/usr/include/oracle/11.1/client64/下面

 

         rpm -ivh oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm 

 

        注Linux X86_64下要進行如下設定

 

             ln -s /usr/lib/oracle/11.1/client64 /usr/lib/oracle/11.1/client<br /> ln -s /usr/include/oracle/11.1/client64 /usr/include/oracle/11.1/client 

 

    3> 解壓sdk並把裡面的sdk包拷貝到/usr/include/下

 

        unzip sdk-11.1.0.7.0-linux-x86_64.zip<br /> cp -fr instantclient_11_1/sdk /usr/include/ 

 

    4> 設定ORACLE_HOME與LD_LIBRARY_PATH 和 NLS_LANG

 

         在/etc/profile檔案最後,添加如下三行


            export ORACLE_HOME=/usr/lib/oracle/11.1/client64/<br />export LD_LIBRARY_PATH=/usr/lib/oracle/11.1/client64:$LD_LIBRARY_PATH<br />export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" 

 

        使剛才的環境變數生效

 

              [root ~] # source /etc/profile 

 

2)安裝pdo_oci

    1> 安裝 re2c

下載 wget http://downloads.sourceforge.net/re2c/re2c-0.12.3.tar.gz

 

tar zxvf re2c-0.12.3.tar.gz<br />cd re2c-0.12.3<br />./configure<br />make<br />make install 

 

    2> 安裝 pdo_oci

如果是PHP5.3以上的版本,內建有PDO_OCI原檔案存在php-5.3.X/ext/pdo_oci/下,如果有則無需下載編譯檔案。

下載 wget http://pecl.php.net/get/PDO_OCI-1.0.tgz

 

tar xzvf PDO_OCI-1.0.tgz<br />cd PDO_OCI-1.0<br />/usr/local/webserver/php/bin/phpize<br />ln -s /usr/include/oracle/11.1 /usr/include/oracle/10.2.0.3<br />ln -s /usr/lib/oracle/11.1 /usr/lib/oracle/10.2.0.3<br />./configure --with-pdo-oci=instantclient,/usr,10.2.0.3<br />make<br />make install 

 

如果編譯出現:make: *** [pdo_oci.lo] Error 1 或 make: *** [pdo_oci.la] Error 1 錯誤,則是缺少Oci庫檔案,把庫檔案複製到編譯目錄下:

 

cp -f /usr/include/oracle/10.2.0.3/client64/* include/ 

 

重新再編譯:

 

 

make && make install 

 

編譯完成會在/usr/local/lib/php/extensions目錄下多出no-debug-non-zts-20090626目錄,在/usr/local/lib/php/extensions/no-debug-non-zts-20090626/下產生pdo_oci.so檔案。

 

3) 修改php.ini

   添加

 

extension = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626/pdo_oci.so" 

 

   php -m | grep PDO 查看是否擴充成功,如果有以下擴充說明成功了

 

PDO

PDO_OCI 


 

 

 

相關文章

聯繫我們

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