2010年04月15日

PHPインストール

#PHPソース取得
wget http://jp.php.net/get/php-5.2.13.tar.gz/from/this/mirror

#圧縮ファイルを展開
tar zxfv php-5.2.13.tar.gz

#展開先に移動
cd php-5.2.13

#コンパイル環境設定
./configure \
--prefix=/usr/local/php5 \
--with-apxs2=/usr/local/httpd-2.2.15/bin/apxs \
--enable-mbstring \
--enable-zend-multibyte \
--enable-ftp \
--enable-sockets \
--with-mysql=/usr/local/mysql \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-zlib \
--with-openssl

#configure: error: xml2-config not found. Please check your libxml2 installation.
#configure: error: Cannot find OpenSSL's
#configure: error: libjpeg.(a|so) not found.
#configure: error: libpng.(a|so) not found.
#configure: error: freetype.h not found.
#と出てエラーでとまったので、下記をインストール

su
apt-get update
apt-get install libxml2 libxml2-devel
apt-get install libjpeg libjpeg-devel
apt-get install libpng libpng-devel
apt-get install openssl-devel
apt-get install freetype freetype-devel

#freetypeはインストールしても、発見できなかったので指定する。

#場所調査
whereis freetype
freetype: /usr/include/freetype.h /usr/include/freetype

--with-freetype-dir=/usr/include/freetype

#がこれでも無理
#freetype2が出ているみたいなので、こっちを入れて指定してみる。

--with-freetype-dir=/usr/include/freetype2

#成功

./configure \
--prefix=/usr/local/php5 \
--with-apxs2=/usr/local/httpd-2.2.15/bin/apxs \
--enable-mbstring \
--enable-zend-multibyte \
--enable-ftp \
--enable-sockets \
--with-mysql=/usr/local/mysql \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir=/usr/include/freetype2 \
--with-zlib \
--with-openssl


#コンパイル
make

#テスト
make test

#テスト結果

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped : 50
Exts tested : 29
---------------------------------------------------------------------

Number of tests : 8889 6734
Tests skipped : 2155 ( 24.2%) --------
Tests warned : 1 ( 0.0%) ( 0.0%)
Tests failed : 10 ( 0.1%) ( 0.1%)
Expected fail : 3 ( 0.0%) ( 0.0%)
Tests passed : 6720 ( 75.6%) ( 99.8%)
---------------------------------------------------------------------
Time taken : 449 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Testing declare statement with several type values [Zend/tests/declare_001.phpt]
Zend Multibyte and UTF-16 BOM [Zend/tests/multibyte/multibyte_encoding_003.phpt]
Test DateTime::modify() function : usage variation - Passing unexpected values to first argument $modify. [ext/date/tests/DateTime_modify_variation1.phpt]
Test date_modify() function : usage variation - Passing unexpected values to second argument $format. [ext/date/tests/date_modify_variation2.phpt]
Test date_sunrise() function : usage variation - Passing unexpected values to fifth argument zenith [ext/date/tests/date_sunrise_variation5.phpt]
Bug #43073 (TrueType bounding box is wrong for angle<>0) [ext/gd/tests/bug43073.phpt]
Test imagecolorallocate() function : usage variations - passing different data types to fourth argument [ext/gd/tests/imagecolorallocate_variation4.phpt]
SPL: DirectoryIterator test getGroup [ext/spl/tests/DirectoryIterator_getGroup_basic.phpt]
SPL: Spl Directory Iterator test getOwner [ext/spl/tests/DirectoryIterator_getOwner_basic.phpt]
Test gethostbyaddr() function : basic functionality [ext/standard/tests/network/gethostbyaddr_basic1.phpt]
microtime() function [ext/standard/tests/time/001.phpt] (warn: system dependent)
=====================================================================

=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
output buffering - fatalism [tests/output/ob_011.phpt]
ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush() [tests/output/ob_start_basic_unerasable_005.phpt]
SPL: ArrayObject::exchangeArray() basic usage with object as underlying data store. [ext/spl/tests/arrayObject_exchangeArray_basic3.phpt]
=====================================================================

=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
microtime() function [ext/standard/tests/time/001.phpt] (warn: system dependent)
=====================================================================

#調べるとエラーは出るがインストールできるようです。

#ルートになる
su

#インストール
make install

Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/php5/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php5/include/php/ext/pdo/

#設定ファイルの雛形をコピー
cp ./php.ini-dist /usr/local/php5/lib/php.ini

#設定する
vi /usr/local/php5/lib/php.ini
log_errors = On
error_log = /var/log/php/php_error.log
display_startup_errors = On
mbstring.language = Japanese
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto

#ログディレクトリ作成
mkdir /var/log/php


#httpd.conf確認しphp5_moduleの下に2行追加
vi /etc/httpd/httpd.conf
chown daemon:daemon -R /var/log/php

LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php .phtml

#DirectoryIndexにも追加しておく
DirectoryIndex index.html index.php index.phtml

#文法チェック
#/usr/local/httpd-2.2.15/bin/apachectl configtest

#Apache再起動
/usr/local/httpd-2.2.15/bin/apachectl stop
/usr/local/httpd-2.2.15/bin/apachectl start

#動作テスト
vi /var/www/html/phpinfo.php


#Loaded Configuration Fileがnoneになって読み込めていない。

#Configuration File (php.ini) Path /usr/local/php5/lib

#だから、

#/usr/local/php5/lib/php.ini

#に入れたのだが・・・。

#configureのヘルプを見てみると

./configure --help | grep php.ini
Set the path in which to look for php.ini [PREFIX/lib]

#とprefix/libだから、間違っていないはず。
#シンボリックリンクにしてみる。

ln -s /usr/local/php5/lib/php.ini /usr/local/lib/php.ini

#Apache再起動
/usr/local/httpd-2.2.15/bin/apachectl stop
/usr/local/httpd-2.2.15/bin/apachectl start

#なぜか指定したパスで表示されました。
Loaded Configuration File /usr/local/php5/lib/php.ini

#しかしオプションで指定したモジュールが読み込まれていないので
#--with-config-file-path=PATHをconfigureに加えてやり直し

exit

./configure \
--prefix=/usr/local/php5 \
--with-config-file-path=/usr/local/php5/lib \
--with-apxs2=/usr/local/httpd-2.2.15/bin/apxs \
--enable-mbstring \
--enable-zend-multibyte \
--enable-ftp \
--enable-sockets \
--with-mysql=/usr/local/mysql \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir=/usr/include/freetype2 \
--with-zlib \
--with-openssl

#コンパイル
make

#インストール
su
make install

#Apache再起動
/usr/local/httpd-2.2.15/bin/apachectl stop
/usr/local/httpd-2.2.15/bin/apachectl start

#成功です。
posted by ギア at 14:25| Comment(1) | TrackBack(0) | LAMP関係
この記事へのコメント
O{haH%Aa, anime.ex-navi.biz, 変態なお姉ちゃん3Dアニメ, http://anime.ex-navi.biz/3d/87.html
Posted by 変態なお姉ちゃん3Dアニメ at 2011年10月01日 12:10
コメントを書く
お名前:

メールアドレス:

ホームページアドレス:

コメント:

この記事へのトラックバックURL
http://blog.sakura.ne.jp/tb/37122199

この記事へのトラックバック