画像やEXIFを利用したサイトを利用したいので,PHPのインストールオプションを以下のように設定
してインストールしてみた。モジュールが足りないやオプションを間違えている等の部分はあったが
結果的にはインストール出来たので忘れないように,備忘録に記入。
=================画像系のライブラリーを扱う為の事前準備==================
[root@localhost ~]# yum -y install flex libxml2-devel
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 315 kB 00:00
updates : ################################################## 723/723
Added 4 new packages, deleted 0 old in 3.93 seconds
Parsing package install arguments
Nothing to do
[root@localhost ~]# yum -y install zlib-devel libpng-devel
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for libpng-devel to pack into transaction set.
libpng-devel-1.2.10-7.0.2 100% |=========================| 11 kB 00:00
—> Package libpng-devel.i386 2:1.2.10-7.0.2 set to be updated
–> Running transaction check
–> Processing Dependency: libpng = 2:1.2.10-7.0.2 for package: libpng-devel
–> Restarting Dependency Resolution with new changes.
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for libpng to pack into transaction set.
libpng-1.2.10-7.0.2.i386. 100% |=========================| 11 kB 00:00
—> Package libpng.i386 2:1.2.10-7.0.2 set to be updated
–> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libpng-devel i386 2:1.2.10-7.0.2 updates 182 k
Updating for dependencies:
libpng i386 2:1.2.10-7.0.2 updates 241 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 423 k
Downloading Packages:
(1/2): libpng-devel-1.2.1 100% |=========================| 182 kB 00:00
(2/2): libpng-1.2.10-7.0. 100% |=========================| 241 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : libpng ######################### [1/3]
Installing: libpng-devel ######################### [2/3]
Cleanup : libpng ######################### [3/3]
Installed: libpng-devel.i386 2:1.2.10-7.0.2
Dependency Updated: libpng.i386 2:1.2.10-7.0.2
Complete!
[root@localhost ~]# yum -y install libjpeg-devel
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for libjpeg-devel to pack into transaction set.
libjpeg-devel-6b-37.i386. 100% |=========================| 6.3 kB 00:00
—> Package libjpeg-devel.i386 0:6b-37 set to be updated
–> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libjpeg-devel i386 6b-37 base 105 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 105 k
Downloading Packages:
(1/1): libjpeg-devel-6b-3 100% |=========================| 105 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libjpeg-devel ######################### [1/1]
Installed: libjpeg-devel.i386 0:6b-37
Complete!
[root@localhost ~]#
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# ls
[root@localhost src]# wget http://jp.php.net/get/php-5.2.4.tar.gz/from/this/mirror
–01:00:34– http://jp.php.net/get/php-5.2.4.tar.gz/from/this/mirror
jp.php.net をDNSに問いあわせています… 61.195.146.164
jp.php.net|61.195.146.164|:80 に接続しています… 接続しました。
HTTP による接続要求を送信しました、応答を待っています… 302 Found
場所: http://jp.php.net/distributions/php-5.2.4.tar.gz [続く]
–01:00:34– http://jp.php.net/distributions/php-5.2.4.tar.gz
jp.php.net|61.195.146.164|:80 に接続しています… 接続しました。
HTTP による接続要求を送信しました、応答を待っています… 200 OK
長さ: 9705468 (9.3M) [application/x-gzip]
Saving to: `php-5.2.4.tar.gz’
100%[============================================================================>] 9,705,468 4.47M/s in 2.1s
01:00:37 (4.47 MB/s) – `php-5.2.4.tar.gz’ を保存しました [9705468/9705468]
[root@localhost src]#
[root@localhost src]# tar -xzvf php-5.2.4.tar.gz
[root@localhost php-5.2.4]# ./configure \
> –prefix=/usr/local/php-5.2.4 \
> –with-apxs2=/usr/local/apache2/bin/apxs \
> –with-config-file-path=/usr/local/php-5.2.4/lib/ \
> –with-gd \
> –with-jpeg-dir=/usr/local \
> –with-png-dir=/usr/local \
> –with-gd \
> –with-zlib \
> –with-zlib-dir=/usr/local \
> –with-xml \
> –with-openssl \
> –with-config-file-path=/etc \
> –with-libmbfl \
> –with-mcrypt \
> –with-mime-magic \
> –with-mysql \
> –enable-pcntl \
> –enable-trans-sid \
> –enable-zend-multibyte \
> –enable-mbstr-enc-trans \
> –enable-mbstring \
> –enable-mbregex \
> –enable-gd-native-ttf \
> –enable-gd-jis-conv \
> –enable-exif
creating cache ./config.cache
checking for Cygwin environment… no
checking for mingw32 environment… no
checking for egrep… grep -E
checking for a sed that does not truncate output… /bin/sed
checking host system type…
===================その他オプションメモ書き===================
–enable-module=all
モジュールをすべて有効に
–enable-shared=max
DSO(Dynamic Shared Object)のサポート。PHPをインストールする際に必要
–with-apxs=/usr/local/apache/bin/apxs
DSOを利用するために、apxsコマンドのパスを指定
–with-mysql
PHPからMySQLを操作するための指定。MySQLを/usr/localや/usrなどではない場所に
インストールしている場合は、パスの指定が必要(例:–with-mysql=/home/mysql)
=========================================================
configure: error: mcrypt.h not found. Please reinstall libmcrypt. <——- libmcryptが無い!!
[root@localhost php-5.2.4]#
[root@localhost php-5.2.4]# yum install libmcrypt
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for libmcrypt to pack into transaction set.
libmcrypt-2.5.7-5.el5.cen 100% |=========================| 3.8 kB 00:00
—> Package libmcrypt.i386 0:2.5.7-5.el5.centos set to be updated
–> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libmcrypt i386 2.5.7-5.el5.centos extras 123 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 123 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libmcrypt-2.5.7-5. 100% |=========================| 123 kB 00:15
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libmcrypt ######################### [1/1]
Installed: libmcrypt.i386 0:2.5.7-5.el5.centos
Complete!
[root@localhost php-5.2.4]#
checking for mcrypt support… yes
configure: error: mcrypt.h not found. Please reinstall libmcrypt. <—-まだ無いと言われる。
[root@localhost php-5.2.4]# yum install libmcrypt-devel
Loading “installonlyn” plugin
Setting up Install Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
–> Populating transaction set with selected packages. Please wait.
—> Downloading header for libmcrypt-devel to pack into transaction set.
libmcrypt-devel-2.5.7-5.e 100% |=========================| 3.2 kB 00:00
—> Package libmcrypt-devel.i386 0:2.5.7-5.el5.centos set to be updated
–> Running transaction check
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
libmcrypt-devel i386 2.5.7-5.el5.centos extras 103 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 103 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): libmcrypt-devel-2. 100% |=========================| 103 kB 00:02
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: libmcrypt-devel ######################### [1/1]
Installed: libmcrypt-devel.i386 0:2.5.7-5.el5.centos
Complete!
[root@localhost php-5.2.4]#
configure: error: Cannot find MySQL header files under yes.
Note that the MySQL client library is not bundled anymore!
↑
MYSQL5.0.45をSourceから入れたので開発ライブラリーが無い。
[root@localhost src]# wget ftp://ftp.pbone.net/mirror/dev.mysql.com/pub/Downloads/MySQL-5.0/MySQL-devel-5.0.45-0.glibc23.i386.rpm
[root@localhost src]# rpm -ivh MySQL-devel-5.0.45-0.glibc23.i386.rpm
準備中… ########################################### [100%]
1:MySQL-devel ########################################### [100%]
[root@localhost src]# ./configure \
–prefix=/usr/local/php-5.2.4 \
–with-apxs2=/usr/local/apache2/bin/apxs \
–with-config-file-path=/usr/local/php-5.2.4/lib/ \
–with-gd \
–with-jpeg-dir=/usr/local \
–with-png-dir=/usr/local \
–with-gd \
–with-zlib \
–with-zlib-dir=/usr/local \
–with-xml \
–with-openssl \
–with-config-file-path=/etc \
–with-libmbfl \
–with-mcrypt \
–with-mime-magic \
–with-mysql \
–enable-pcntl \
–enable-trans-sid \
–enable-zend-multibyte \
–enable-mbstr-enc-trans \
–enable-mbstring \
–enable-mbregex \
–enable-gd-native-ttf \
–enable-gd-jis-conv \
–enable-exif
—–省略——-
Generating files
updating cache ./config.cache
creating ./config.status
creating php5.spec
creating main/build-defs.h
creating scripts/phpize
creating scripts/man1/phpize.1
creating scripts/php-config
creating scripts/man1/php-config.1
creating sapi/cli/php.1
creating main/php_config.h
creating main/internal_functions.c
creating main/internal_functions_cli.c
+——————————————————————–+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+——————————————————————–+
Thank you for using PHP.
Notice: Following unknown configure options were used:
–with-xml
(ここに答えがありました:http://www.thinkit.co.jp/free/marugoto/1/5/3/1.html)
–enable-trans-sid
(–enable-trans-idの間違え)
–enable-mbstr-enc-trans
(PHP 4.3.0 以降、このオプション –enable-mbstr-enc-trans は廃止で実行時の設定 mbstring.encoding_translationにに変更)
Check ‘./configure –help’ for available options
[root@localhost php-5.2.4]#
とりあえず,オプションのミスはあったもののconfigureは成功3つ程オプションが無視されたが,緊急で必要では
ないので,次回ちゃんとオプションを直して再度,make cleanしてconfigureする事とする。
[root@localhost php-5.2.4]# make
gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory
make: *** [libphp5.la] エラー 1
[root@localhost src]# wget ftp://ftp.pbone.net/mirror/dev.mysql.com/pub/Downloads/MySQL-5.0/MySQL-client-community-5.0.45-0.sles10.i586.rpm
–02:37:26– ftp://ftp.pbone.net/mirror/dev.mysql.com/pub/Downloads/MySQL-5.0/MySQL-client-community-5.0.45-0.sles10 .i586.rpm
=> `MySQL-client-community-5.0.45-0.sles10.i586.rpm’
ftp.pbone.net をDNSに問いあわせています… 85.14.85.4
ftp.pbone.net|85.14.85.4|:21 に接続しています… 接続しました。
anonymous としてログインしています… ログインしました!
==> SYST … 完了しました。 ==> PWD … 完了しました。
==> TYPE I … 完了しました。 ==> CWD /mirror/dev.mysql.com/pub/Downloads/MySQL-5.0 … 完了しました。
==> SIZE MySQL-client-community-5.0.45-0.sles10.i586.rpm … 12538161
==> PASV … 完了しました。 ==> RETR MySQL-client-community-5.0.45-0.sles10.i586.rpm … 完了しました。
長さ: 12538161 (12M)
100%[====================================================================================================================>] 12,538,161 221K/s in 57s
02:38:28 (215 KB/s) – `MySQL-client-community-5.0.45-0.sles10.i586.rpm’ を保存しました [12538161]
[root@localhost src]#
[root@localhost src]# rpm -ivh MySQL-client-community-5.0.45-0.sles10.i586.rpm
準備中… ########################################### [100%]
1:MySQL-client-community ########################################### [100%]
[root@localhost src]#
[root@localhost php-5.2.4]# make
gcc: /usr/lib/mysql/libmysqlclient.so: No such file or directory
make: *** [libphp5.la] エラー 1
[root@localhost php-5.2.4]# ls /usr/
X11R6/ bin/ etc/ games/ include/ kerberos/ lib/ libexec/ local/ sbin/ share/ src/ tmp/
[root@localhost php-5.2.4]# ls /usr/lib/mysql/lib
libdbug.a libmyisam.a libmysqlclient.la libmystrings.a libndbclient.la libz.la
libheap.a libmyisammrg.a libmysqlclient_r.a libmysys.a libvio.a
libmygcc.a libmysqlclient.a libmysqlclient_r.la libndbclient.a libz.a
[root@localhost php-5.2.4]# find / -name “libmysqlclient.so”
/home/admin/postsource/mysql-5.0.45/libmysql/.libs/libmysqlclient.so
[root@localhost php-5.2.4]#
[root@localhost php-5.2.4]# cp /home/admin/postsource/mysql-5.0.45/libmysql/.libs/libmysqlclient.so /usr/lib/mysql/libmysqlclient.so
[root@localhost php-5.2.4]# ldconfig
[root@localhost php-5.2.4]#
何回か失敗したので,せっかくなのでConfigureし直す事にした。(一応make clean)
./configure \
–prefix=/usr/local/php-5.2.4 \
–with-apxs2=/usr/local/apache2/bin/apxs \
–with-config-file-path=/usr/local/php-5.2.4/lib/ \
–with-gd \
–with-jpeg-dir=/usr/local \
–with-png-dir=/usr/local \
–with-gd \
–with-zlib \
–with-zlib-dir=/usr/local \
–with-xml \
–with-openssl \
–with-config-file-path=/etc \
–with-libmbfl \
–with-mcrypt \
–with-mime-magic \
–with-mysql \
–enable-pcntl \
–enable-trans-id \
–enable-zend-multibyte \
–enable-mbstring \
–enable-mbregex \
–enable-gd-native-ttf \
–enable-gd-jis-conv \
–enable-exif
[root@localhost php-5.2.4]# make
api/cli/getopt.lo main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lmysqlclient -lmcrypt -lpng -lz -ljpeg -lz -lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -o sapi/cli/php
Build complete.
Don’t forget to run ‘make test’.
[root@localhost php-5.2.4]# make test
/usr/local/src/php-5.2.4/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory
/usr/local/src/php-5.2.4/sapi/cli/php: error while loading shared libraries: libmysqlclient.so.15: cannot open shared object file: No such file or directory
make: [test] エラー 127 (無視されました)
[root@localhost php-5.2.4]#
[root@localhost php-5.2.4]# cp /home/admin/postsource/mysql-5.0.45/libmysql/.libs/libmysqlclient.so.15 /usr/lib/mysql/
[root@localhost php-5.2.4]# ldconfig
[root@localhost php-5.2.4]# make test
=====================================================================
TEST RESULT SUMMARY
———————————————————————
Exts skipped : 48
Exts tested : 31
———————————————————————
Number of tests : 3973 2632
Tests skipped : 1341 ( 33.8%) ——–
Tests warned : 1 ( 0.0%) ( 0.0%)
Tests failed : 5 ( 0.1%) ( 0.2%)
Tests passed : 2626 ( 66.1%) ( 99.8%)
———————————————————————
Time taken : 494 seconds
=====================================================================
=====================================================================
FAILED TEST SUMMARY
———————————————————————
libgd #106 (imagerectangle 1×1 draws 1×3) [ext/gd/tests/libgd00106.phpt]
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15) [ext/standard/tests/strings/htmlentities02.phpt] (warn: possibly braindead libc)
htmlentities() test 4 (setlocale / ja_JP.EUC-JP) [ext/standard/tests/strings/htmlentities04.phpt]
htmlentities() test 15 (setlocale / KOI8-R) [ext/standard/tests/strings/htmlentities15.phpt]
=====================================================================
※幾つかエラーが出てしまった。とりあえず,それ程問題になりそうではないので今回は無視。
[root@localhost php-5.2.4]# 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 /usr/local/src/php-5.2.4/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/php-5.2.4/bin/
Installing PHP CLI man page: /usr/local/php-5.2.4/man/man1/
Installing build environment: /usr/local/php-5.2.4/lib/php/build/
Installing header files: /usr/local/php-5.2.4/include/php/
Installing helper programs: /usr/local/php-5.2.4/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/php-5.2.4/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/php-5.2.4/lib/php/
[PEAR] Console_Getopt – installed: 1.2.3
[PEAR] Archive_Tar – installed: 1.3.2
[PEAR] Structures_Graph- installed: 1.0.2
pear/PEAR can optionally use package “pear/XML_RPC” (version >= 1.4.0)
[PEAR] PEAR – installed: 1.6.1
Wrote PEAR system config file at: /usr/local/php-5.2.4/etc/pear.conf
You may want to add: /usr/local/php-5.2.4/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php-5.2.4/include/php/ext/pdo/
[root@localhost php-5.2.4]#
今後のバージョン変更の為にシンボリックリンクを貼って終了。
[root@localhost php-5.2.4]# ln -sfn /usr/local/php-5.2.4 /usr/local/php
[root@localhost php-5.2.4]# ls -l /usr/local/php
lrwxrwxrwx 1 root root 20 10月 13 03:44 /usr/local/php -> /usr/local/php-5.2.4
[root@localhost php-5.2.4]#