yum php-pecl-apc でAPC をインストールしますと、次のようにファイルが作成されました。
- /usr/include/php/ext/apc/apc_serializer.h
- /usr/lib/php/modules/apc.so
- /etc/php.d/apc.ini
でもわたくし、ソースからコンパイルして APC をインストールして、ファイルのインストール先を変更したいです!
以前の投稿、APC をソースから make でコンパイルしてインストール!!! | oki2a24、からの予想で、./configure のオプションでなんとかなるのではないかとアタリをつけています。検索してみますと、大変参考になりそうなページを発見いたしました。
このページを拝見しますと、インストールディレクトリを –prefix で設定できるとあります。これで apc.so のインストール先は変更できそうですね。
また、./configure のヘルプが参考になるとのことで、APC ソースを解凍した場所から解凍フォルダ内にいどうしまして ./configure のヘルプを見てみました。–prefix 以外に、apc_serializer.h については –includedir オプションが怪しそうです。
- –prefix=PREFIX install architecture-independent files in PREFIX [/usr/local]
- –includedir=DIR C header files [PREFIX/include]
それぞれの最後にある [] はデフォルト値でありましょう。ヘルプを抜粋しまして実際にいろいろ試してみました。
[root@localhost APC-3.1.13]# ./configure --help
`configure' configures this package to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as
VAR=VALUE. See below for descriptions of some of the useful variables.
Defaults for the options are specified in brackets.
Configuration:
-h, --help display this help and exit
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
-q, --quiet, --silent do not print `checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for `--cache-file=config.cache'
-n, --no-create do not create output files
--srcdir=DIR find the sources in DIR [configure dir or `..']
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
[PREFIX]
By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc. You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
--bindir=DIR user executables [EPREFIX/bin]
--sbindir=DIR system admin executables [EPREFIX/sbin]
--libexecdir=DIR program executables [EPREFIX/libexec]
--datadir=DIR read-only architecture-independent data [PREFIX/share]
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
--infodir=DIR info documentation [PREFIX/info]
--mandir=DIR man documentation [PREFIX/man]
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
--target=TARGET configure for building compilers for TARGET [HOST]
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-apc Enable APC support
--enable-apc-debug Enable APC debugging
--enable-apc-filehits Enable per request file info about files used from the APC cache (ie: apc_cache_info('filehits'))
--disable-apc-mmap
Disable mmap support and use IPC shm instead
--enable-apc-sem
Enable semaphore locks instead of fcntl
--disable-apc-pthreadmutex
Disable pthread mutex locking
--enable-apc-pthreadrwlocks
Enable pthread read/write locking
--enable-apc-spinlocks
Enable spin locks EXPERIMENTAL
--enable-apc-memprotect
Enable mmap/shm memory protection
--disable-valgrind-checks
Disable valgrind based memory checks
--enable-coverage DEVELOPERS ONLY!!
--enable-shared[=PKGS]
build shared libraries [default=yes]
--enable-static[=PKGS]
build static libraries [default=yes]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-libdir=NAME Look for libraries in .../NAME rather than .../lib
--with-php-config=PATH Path to php-config php-config
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-tags[=TAGS]
include additional configurations [automatic]
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L if you have libraries in a
nonstandard directory
CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have
headers in a nonstandard directory
CPP C preprocessor
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
[root@localhost APC-3.1.13]#
ソースからコンパイルして、APC を好きな場所にインストールできますか?→結論
上手くいかないです><。
めげずにいろいろ試してみました。そして、わかりました。
- APC は –prefix が無効
- APC は –includedir が無効
この結論を得るために、./configure のオプションを試しまして、もちろんうまくいきませんでした。
わたくしは ./configure 慣れしておりませんので使い方に不安もありました。それで参考ページで行われていることを実際にやってみますと、自由な場所にインストールできました。この時点で「あ、APC はソースからコンパイルしても任意の場所にインストールできないのですね」気が付きました。
しくしくとすさび泣きながら、最後に vim で./configure を開いて見回してみますと、どうもやはり –prefix と –includedir には PHP の設定から取得した値を固定的に設定しているように見えます。これらの設定値だけではありません。他にも同じように固定化されているオプションがごろごろございました。
といっても、慎重に検証したわけではございませんので全然外れていたり、実は APC を好きな場所にインストールできるのかもしれません。
ですけれども、今のわたくしにとっては、APC は好きな場所にインストールできないもの、という結論となりました。
おわりに
APC をとある場所にインストールする必要がありましたから、試行錯誤いたしましたのに、失敗、という結果となってしまいました><。この件については、めげずに別の方法を検討いたしましょう!
ですけれども、大きな収穫もありました。パッケージをソースからコンパイルしてインストールすることに少し慣れることができました。
また、PECL コマンドでの APC インストールは結局、phpize、./configure、make、make install、pear への登録を連続して行なっているだけ、ということも知ることができました。
インストールログをつぶさに見ることができた経験は大きいと感じています。だって、これからはインストールに失敗しても、きっと原因特定が早くなりますから♪
最後に、参考にさせていただいたページをもう一度紹介いたします。このページのおかげで不安に陥ってもすぐに持ち直すことができました。ありがとうございます!
いつか参考ページのようにソースからのインストールで LAMP 環境が作れたら、かっこいいと思います。
以上です。
