SORICH SAMURAIby SORICH

hello,world

2010年6月
             
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

最新の記事

カテゴリー

月間アーカイブ

最新のトラックバック

最新のトラックバック

ubuntu    2010.02.01 [ Mon ] 15:15

Ubuntu 8.04, Apache2.2, PHP5.2, Oracle 10g XEでサーバーを構築した時のメモです。


===== Oracle Database 10g Express Edition のインストール =====

[ubuntu][oracle]Oracle Database 10g Express Editionをインストールする - hello,world

===== Oracle Instant Client のインストール =====

Instant ClientのダウンロードからInstant Clientパッケージ - Basic と *Instant Clientパッケージ - SDK をダウンロードします。

aptitude でインストールされたOracle Database 10g Express Editionは10.2.0.1-1ですが、Instant Clientのダウンロードサイトに同じバージョンのものがなかったので、バージョン10.2.0.4のものをダウンロードしました。
ダウンロードしたアーカイブを解凍して、シンボリックリンクを作成します。
root@ubuntu:~# mkdir -p /opt/oracle
root@ubuntu:~# unzip \*.zip -d /opt/oracle
...
root@ubuntu:~# cd /opt/oracle
root@ubuntu:/opt/oracle# ln -s instantclient_10_2/ instantclient
root@ubuntu:/opt/oracle# cd instantclient
root@ubuntu:/opt/oracle/instantclient# ln -s libclntsh.so.10.1 libclntsh.so
root@ubuntu:/opt/oracle/instantclient# ln -s libocci.so.10.1 libocci.so

===== PHPのインストール =====

PHP関連をインストールします。Apacheもインストールされます。
root@ubuntu:~# aptitude install php5 php5-cli php5-dev php-pear libaio1

oci8をインストールします。
root@ubuntu:~# pecl install oci8
downloading oci8-1.3.5.tgz ...
Starting to download oci8-1.3.5.tgz (137,987 bytes)
.............................done: 137,987 bytes
10 source files, building
running: phpize
Configuring for:
PHP Api Version:         20041225
Zend Module Api No:      20060613
Zend Extension Api No:   220060519
 1. Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client : autodetect

>A> 1-1, 'all', 'abort', or Enter to continue: all
>B> Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : instantclient,/opt/oracle/instantclient                              
 1. Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client : instantclient,/opt/oracle/instantclient

1-1, 'all', 'abort', or Enter to continue: 
building in /var/tmp/pear-build-root/oci8-1.3.5
running: /tmp/pear/cache/oci8-1.3.5/configure --with-oci8=instantclient,/opt/oracle/instantclient
...
(中略)
...
Build process completed successfully
Installing '/usr/lib/php5/20060613+lfs/oci8.so'
install ok: channel://pecl.php.net/oci8-1.3.5
configuration option "php_ini" is not set to php.ini location
You should add "extension=oci8.so" to php.ini
>A>の行で「all」
>B>の行で「instantclient,/opt/oracle/instantclient 」と入力しています。
その他は[Enter]です。

もしくは環境変数 ORACLE_HOME に instantclient,/opt/oracle/instantclient を設定すれば、すべて[Enter]でもだいじょうぶぽいです。

oci8.soを読み込むようにします。
root@ubuntu:~# echo extension=oci8.so >> /etc/php5/apache2/conf.d/oci8.ini

===== 文字コードの設定 =====
root@ubuntu:~# echo "export NLS_LANG=JAPANESE_JAPAN.AL32UTF8" >> /etc/apache2/envvars
※Oracle Database 10g Express Editionのデフォルトの文字コードはUTF-8です。
文字コードについてはこちらに詳しく書いてありました。
Olacle 文字コード

===== 確認 =====

Apacheを再起動して、phpinfo()を確認してみます。
root@ubuntu:/var/www# service apache2 restart
 * Restarting web server apache2
   ...done.
root@ubuntu:~# echo '<?php phpinfo();?>' >> /var/www/phpinfo.php
ブラウザで /phpinfo.php にアクセスして oci8 の項目が表示されていればOKです。 phpinfo.png

参考
Something what I like.: Ubuntu 8.04 LTSに PHP と OCI8 をインストール

トラックバック(0) コメント(0)

カテゴリ:

コメントする




トラックバック(0)

このブログ記事を参照しているブログ一覧: [ubuntu][apache][php][oracle]サーバー構築のメモ


このブログ記事に対するトラックバックURL:

Copyright(C) SORICH Ltd. All Rights Reserved.