apache,mysqlにGDやその他ライブラリが準備が整ったとこでいよいよphpインストールしていきます。
phpインストール
ここからソースをDL http://www.php.net/downloads.php
$wget http://jp2.php.net/get/php-5.3.8.tar.gz/from/jp.php.net/mirror
$tar xzvf php-5.3.8.tar.gz
$cd php-5.3.8
#./configure –prefix=/usr/local/php5 –with-apxs2=/usr/local/apache2/bin/apxs –disable-all –enable-libxml –with-libxml-dir=/usr/local –enable-zend-multibyte –with-regex=php –enable-filter –with-pcre-regex=yes –with-mysql=/usr/local/mysql –with-gd
$make
$make test
今回configure時に一部権限でエラーを吐いたので、rootで実行しました。
–disable-allオプションを指定してから必要なものだけを入れるようにしてます。
また、オプションは暫定ですので、今後のサービスにより、変更する可能性はあります。
※追記2012/1/27 configureオプション変更がありました。
また、make testでいくつかエラー出たようなので、メモ
EXPECTED FAILED TEST SUMMARY
———————————————————————
output buffering – fatalism [tests/output/ob_011.phpt] XFAIL REASON: This test will fail until the fix in revision r214155 is backported from php 6
Inconsistencies when accessing protected members [Zend/tests/access_modifiers_008.phpt] XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Inconsistencies when accessing protected members – 2 [Zend/tests/access_modifiers_009.phpt] XFAIL REASON: Discussion: http://marc.info/?l=php-internals&m=120221184420957&w=2
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770.phpt] XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_2.phpt] XFAIL REASON: See Bug #48770
Bug #48770 (call_user_func_array() fails to call parent from inheriting class) [Zend/tests/bug48770_3.phpt] XFAIL REASON: See Bug #48770
DateTime::add() — fall type2 type2 [ext/date/tests/DateTime_add-fall-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — fall type2 type3 [ext/date/tests/DateTime_add-fall-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — fall type3 type2 [ext/date/tests/DateTime_add-fall-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — fall type3 type3 [ext/date/tests/DateTime_add-fall-type3-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — spring type2 type2 [ext/date/tests/DateTime_add-spring-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — spring type2 type3 [ext/date/tests/DateTime_add-spring-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — spring type3 type2 [ext/date/tests/DateTime_add-spring-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::add() — spring type3 type3 [ext/date/tests/DateTime_add-spring-type3-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — fall type2 type2 [ext/date/tests/DateTime_diff-fall-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — fall type2 type3 [ext/date/tests/DateTime_diff-fall-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — fall type3 type2 [ext/date/tests/DateTime_diff-fall-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — fall type3 type3 [ext/date/tests/DateTime_diff-fall-type3-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — spring type2 type2 [ext/date/tests/DateTime_diff-spring-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — spring type2 type3 [ext/date/tests/DateTime_diff-spring-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — spring type3 type2 [ext/date/tests/DateTime_diff-spring-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::diff() — spring type3 type3 [ext/date/tests/DateTime_diff-spring-type3-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — fall type2 type2 [ext/date/tests/DateTime_sub-fall-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — fall type2 type3 [ext/date/tests/DateTime_sub-fall-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — fall type3 type2 [ext/date/tests/DateTime_sub-fall-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — fall type3 type3 [ext/date/tests/DateTime_sub-fall-type3-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — spring type2 type2 [ext/date/tests/DateTime_sub-spring-type2-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — spring type2 type3 [ext/date/tests/DateTime_sub-spring-type2-type3.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — spring type3 type2 [ext/date/tests/DateTime_sub-spring-type3-type2.phpt] XFAIL REASON: Various bugs exist
DateTime::sub() — spring type3 type3 [ext/date/tests/DateTime_sub-spring-type3-type3.phpt] XFAIL REASON: Various bugs exist
Bug #51994 (date_parse_from_format is parsing invalid date using ‘yz’ format) [ext/date/tests/bug51994.phpt] XFAIL REASON: Bug #51994 isn’t fixed yet
DateTime::add() and sub() result -1 hour on objects with time zone type 2 [ext/date/tests/bug55253.phpt] XFAIL REASON: Bug 55253 exists
一旦無視してmake install
installログに以下のような記述がありましたので、
rootで実行しました。
httpd.confにphpを関連づける記述も加わってるのが確認できます。
LoadModule php5_module modules/libphp5.so
それにphpを動作させる記述を加えます。
動作確認
phpinfo()を見てみましょう。
$ vi phpinfo.php
phpinfo.phpの中身
<?php phpinfo(); ?>
apache再起動
# /usr/local/apache2/bin/httpd -k start
http://(IPアドレス)/phpinfo.php をブラウザで確認。libxmlやGD、mysqlが無事認識されてました。
LAMP環境完成!
連続でエントリー書いてきました(こちらでまとめてます)が、これでLAMP環境は整ったかと思います。
これ以降は、環境よっては不要かもしれませんが、必要な場合は、参考にしてください。