CentOS さくらVPS PHP インストール

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

何はなくともPHPをインストール

 

インストールされてるか確認する

[user@foo src]$ yum list | grep php

うん、無い。

 

もしインストール済みなかこんな感じで

インストール済みのパッケージをがーーっと削除。

[root@foo ~]# yum remove php
[root@foo ~]# yum remove php-*

 

最新のソースをGET

[user@foo src]$ wget http://www.php.net/get/php-5.3.6.tar.gz/from/us.php.net/mirror

 

解凍してー

[user@foo src]$ tar -zxvf php-5.3.6.tar.gz

 

移動

[user@foo src]$ cd php-5.3.6

 

他サーバーでインストール済みのPHPのconfigureを確認する

# php -i | grep configure

 

んで出てきた内容がこれ

'--with-apxs2=/usr/local/apache2/bin/apxs'
'--enable-mbstring'
'--enable-mbregex'
'--enable-zend-multibyte'
'--enable-ftp'
'--with-gd'
'--enable-gd-native-ttf'
'--with-freetype-dir=/usr/lib'
'--with-png-dir=/usr/lib'
'--with-zlib-dir=/usr/lib'
'--with-jpeg-dir=/usr/lib'
'--with-mysql=/usr'
'--with-iconv'
'--with-kerberos'
'--with-openssl'
'--with-pear'
'--with-dom=/usr/lib'
'--with-dom-xslt=/usr/lib'
'--with-curl=/usr/lib'
'--enable-pcntl'

 

–with-dom 絡みはPHP4向けの古いオプションっぽいのではずす。

–with-zlib 圧縮関係を扱えるように追加する。

 

configureでMySQLのエラーが出たので

configure: error: Cannot find libmysqlclient under /usr.
Note that the MySQL client library is not bundled anymore!

–with-mysql=/usr/bin/ yum で入れたmysqlなので場所が違う

–with-libdir=lib64 64bit用ライブラリの場所指定?

 

も変更。

#./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--enable-mbstring \
--enable-mbregex \
--enable-zend-multibyte \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/lib \
--with-png-dir=/usr/lib \
--with-zlib-dir=/usr/lib \
--with-jpeg-dir=/usr/lib \
--with-mysql=/usr/bin/ \
--with-libdir=lib64 \
--with-iconv \
--with-kerberos \
--with-openssl \
--with-imap-ssl \
--with-pear \
--with-curl=/usr/lib \
--with-zlib \
--enable-pcntl

 

configure 実行でエラー

configure: error: xml2-config not found. Please check your libxml2 installation.

 

怒られた通りに libxml2 をインストール

[root@foo ~]# yum install libxml2 libxml2-devel

 

再度 configure

また怒られた。

configure: error: Please reinstall the libcurl distribution -
    easy.h should be in <curl-dir>/include/curl/

 

curl がねぇよってことでまたも yum から

[root@foo ~]# yum install curl-devel

 

やり直し

configure: error: libjpeg.(a|so) not found.

 

怒られた。

jpegのライブラリがねぇよと。

画像系まとめて入れる。

yum から install

[root@foo ~]# yum install libjpeg-devel libpng-devel

 

…やり直し

今度のエラー

configure: error: freetype.h not found.

 

わーったって。

[root@foo ~]# yum install freetype-devel

 

やっと無事完了。

configure の前に

[root@foo ~]# yum install libxml2-devel curl-devel libjpeg-devel libpng-devel freetype-devel

 

ってやっとけば良かったって事ですな。

 

んでコンパイル実施

[user@foo php-5.3.6]$ make

 

makeも無事完了でmake test

[user@foo php-5.3.6]$ 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

DateInterval::format(), %a [ext/date/tests/DateInterval_format_a.phpt]  XFAIL REASON: Windows VC6 libs floor()/ceil() choke on floats

DateTime::diff() add() sub() -- fall type2 type2 [ext/date/tests/DateTime_diff_add_sub-fall-type2-type2.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- fall type2 type3 [ext/date/tests/DateTime_diff_add_sub-fall-type2-type3.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- fall type3 type2 [ext/date/tests/DateTime_diff_add_sub-fall-type3-type2.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- fall type3 type3 [ext/date/tests/DateTime_diff_add_sub-fall-type3-type3.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- spring type2 type2 [ext/date/tests/DateTime_diff_add_sub-spring-type2-type2.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- spring type2 type3 [ext/date/tests/DateTime_diff_add_sub-spring-type2-type3.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- spring type3 type2 [ext/date/tests/DateTime_diff_add_sub-spring-type3-type2.phpt]  XFAIL REASON: PHP < 5.4 has bugs

DateTime::diff() add() sub() -- spring type3 type3 [ext/date/tests/DateTime_diff_add_sub-spring-type3-type3.phpt]  XFAIL REASON: PHP < 5.4 has bugs

SimpleXML: array casting bug [ext/simplexml/tests/034.phpt]  XFAIL REASON: Does anyone know why?

=====================================================================

=====================================================================
WARNED TEST SUMMARY
---------------------------------------------------------------------
via [ext/pdo_sqlite/tests/common.phpt]
        SQLite PDO Common: Bug #34630 (inserting streams as LOBs) [ext/pdo_sqlite/tests/bug_34630.phpt] (warn: XFAIL section but test passes)
via [ext/sqlite/tests/pdo/common.phpt]
        SQLite2 PDO Common: Bug #34630 (inserting streams as LOBs) [ext/sqlite/tests/pdo/bug_34630.phpt] (warn: XFAIL section but test passes)
Bug #39863 (file_exists() silently truncates after a null byte) [ext/standard/tests/file/bug39863.phpt] (warn: XFAIL section but test passes)
=====================================================================

 

 

Bug絡みのメッセージばっかなのでOKとしておこう

ってか

SimpleXML: array casting bug [ext/simplexml/tests/034.phpt]  XFAIL REASON: Does anyone know why?

 

聞かれても。知らんがな。

 

とにかくinstall

[root@foo php-5.3.6]# make install
Installing PHP SAPI module:       apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp libphp5.la /usr/local/apache2/modules/
cp .libs/libphp5.so /usr/local/apache2/modules/libphp5.so
cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /home/user/src/php-5.3.6/libs'
chmod 755 /usr/local/apache2/modules/libphp5.so
[activating module `php5' in /usr/local/apache2/conf/httpd.conf]
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man page:      /usr/local/man/man1/
Installing build environment:     /usr/local/lib/php/build/
Installing header files:          /usr/local/include/php/
Installing helper programs:       /usr/local/bin/
  program: phpize
  program: php-config
Installing man pages:             /usr/local/man/man1/
  page: phpize.1
  page: php-config.1
Installing PEAR environment:      /usr/local/lib/php/
[PEAR] Archive_Tar    - installed: 1.3.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.2
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
/home/user/src/php-5.3.6/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar
Installing PDO headers:          /usr/local/include/php/ext/pdo/

 

インストール完了ってことで一応バージョン確認

[root@foo php-5.3.6]# php -v
PHP 5.3.6 (cli) (built: Jun 16 2011 19:59:40)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

 

ちゃんと最新版入ってますな。

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

あわせて読みたい

Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /var/www/junkpot.net/tech/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273