2012年2月7日火曜日

Linux CentOS 5.4でPHPインストール

PHPバージョンは5.3.10
 wget http://jp2.php.net/get/php-5.3.10.tar.gz/from/jp.php.net/mirror
 tar xvzf php-5.3.10.tar.gz
 cd php-5.3.10/

configure実行。非常に多くのオプションがあるので、詳細については./configures --helpを参照。
 ./configure --with-apxs2 --enable-mbstring --enable-zend-multibyte --with-mysql
--with-apxsでApacheに組み込む。

apxs2やmysqlにパスが通っていない場合はフルパス指定, 64bitの場合は--with-libdir=lib64を指定する。
 ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --with-zlib-dir=/usr/lib --enable-zend-multibyte --with-mysql=/usr/local --with-libdir=lib64

最後に下記MSGが表示されればOK
 Thank you for using PHP.

make実行
 make
 configure: error: xml2-config not found. Please check your libxml2 installation.
と表示されたので、libxml2-devel をインストール
 yum install libxml2-devel

改めて
 make

make testでコンパイルしたものが実行可能か確認する。
 make test

rootユーザにて、make install実行
 make install

php.ini-developmentを移動する。
※php.ini-productionは運用系のファイル
 [root php-5.3.10]# cp -p php.ini-development /usr/local/lib/php.ini

httpd-confに"AddType"がある部分に追加する。
 AddType application/x-httpd-php .php

Apache再起動
 /etc/rc.d/init.d/httpd restart

phpファイル配置
 /usr/local/apache2/htdocs/pigg/phpinfo.php
 <?php
     phpinfo();
 ?>

"hostsで設定したドメイン/phpinfo.php"にアクセスして、PHPの情報が表示されればOK.
 http://dev.pigg.ameba.jp/phpinfo.php

0 件のコメント:

コメントを投稿