- 追加された行はこの色です。
- 削除された行はこの色です。
* PHPインストール [#u16801f7]
[[(1)インストール前準備>#junbi]]~
[[(2)インストール>#install]]~
[[(3)php.iniの設定>#edit_ini_file]]~
[[(9)phpをCGIとして動かす為の設定>#run_cgi_mode]]
&aname(junbi);
#setlinebreak(on);
(1) インストール前準備 - PHPをインストールする前に入れておくと都合がよいものを先にインストール
・rootになる
su
・jpeg(/usr/local/lib)
tar xvzf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --enable-shared
make
make install # /usr/local/man/man1というディレクトリがない” と怒られたので作ってから再度実行した
・zlib(/usr/local/lib)
tar xvzf zlib-1.2.1.tar.gz
cd zlib-1.2.1
./configure --shared
make
make install
・png(/usr/local/lib) (zlibが必要)
tar xvzf libpng-1.2.5.tar.gz
cd libpng-1.2.5
cp scripts/makefile.std ./makefile
vi ./makefile # makefileを書換え
-- ここから --
ZLIBLIB=/usr/local/lib
ZLIBINC=/usr/local/include
-- ここまで --
make
make install
・GD(/usr/local) ※PHP等から画像を動的に生成する場合は必須(pngが必要)
tar xvzf gd-2.0.12.tar.gz
cd gd-2.0.12
./configure --with-jpeg=/usr/local --with-png=/usr/local
make
make install
・libxml2(/usr/local/lib) ※PHP5を入れるときは必須(libxml2-2.5.10以上)
tar zxfv libxml2-2.6.0.tar.gz
cd libxml2-2.6.0
./configure
make
make install
&aname(install);
(2) PHPのインストール
・rootになる
su
・インストール
cd /usr/local/src
tar zxfv php-5.0.2.tar.gz
cd /usr/local/src/php-5.0.2
./configure --with-pgsql --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-mbregex --without-mysql \
--with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-libxml-dir=/usr/local \
--with-oracle=/opt/app/oracle/product/10.1.0/client_1 --with-oci8=/opt/app/oracle/product/10.1.0/client_1
make
make install
#html(<table><tr><td> [PHPがインストールされる場所]</td></tr><tr><td style="margin-left:10px;padding-top:0px;margin-top:0px;">)
|インストール種別|インストール先|
|DSO版|/usr/local/apache2/modules/libphp5.so|
|CLI版|/usr/local/bin/php|
#html(</td></tr></table>)
&aname(edit_ini_file);
(3) php.iniの設定( /usr/local/lib/php.ini )
vi /usr/local/lib/php.ini
-- ここから --
・
・
中略
・
・
register_globals = Off
mbstring.language = Japanese
mbstring.internal_encoding = SJIS
mbstring.http_input = auto
mbstring.http_output = SJIS
mbstring.encoding_translation = On
mbstring.detect_order = auto
・
・
中略
・
・
-- ここまで --
&aname(run_cgi_mode);
(9) phpをCGIとして動かす為の設定
PHPをCGIとして動かすには、 普通は #!/usr/bin/php などをファイルの頭に追加して・・・等をしなくちゃいけないが、
以下の設定を行うことで Apacheの設定のみで動かす事ができる。
1. Apacheの設定ファイル(httpd.conf)に以下を追加する。
ScriptAlias /php/ "/usr/bin/"
Action application/x-httpd-phpcgi "/php/php"
※ /usr/bin/ は phpがインストールされているディレクトリ(Windowsの場合は、c:/php/ など)
※ /php/php は phpへのpath (Windowsの場合は /php/php-cgi.exe など )
2. Apacheの設定ファイル(httpd.conf) または .hraccess に以下を追加する。
AddHandler application/x-httpd-phpcgi .php
3. php.ini の設定を変更する
cgi.force_redirect = 0
※ホントに要るのかは良くわからん。
<?php phpinfo ?> でも確認したが、コレしなくてもちゃんとcgiとして動いてる。
(調べ足りんかも。。)