Apache2.2 + PHP5.1.4 (OpenBSD)
OpenBSD3.8 i386/Apache2.2.2/PHP5.1.4
ディス鶏付きのPHPやApacheじゃなくて
どちらもソースからコンパイルする。
その他はどうなっても知らん。
0 準備
それぞれソースを取ってくる。
形式にあわせて展開
Apache HTTP Server 2.2.2
http://httpd.apache.org/download.cgi
~/httpd-2.2.2/
PHP 5.1.4
http://www.php.net/downloads.php
~/php-5.1.4/
-- 覚悟完了 --
Beginning Php5, Apache, Mysql Web Development (Programmer to Programmer)
Michael K. Glass,Yann Le Scouarnec,Jason Gerner,Jeremy Stolz
PHPのテキストをみてapache側を設定する
php-5.1.4/INSTALLの
Apache 2.0 on Unix systemsと 2.0.x向けの方にあわせてやってみる。
Example 2-4. Installation Instructions (Apache 2 Shared Module
Version)
1. gzip -d httpd-2_0_NN.tar.gz
2. tar xvf httpd-2_0_NN.tar
3. gunzip php-NN.tar.gz
4. tar -xvf php-NN.tar
5. cd httpd-2_0_NN
6. ./configure --enable-so
7. make
8. make install
1,2,3,4まではバッチりです。
6ではApacheのconfigureで--enable-soしろとある。
んでメイク。
我が家のApacheのconfigureオプション
./configure ¥
--prefix=/opt/httpd22 --enable-so --enable-threads ¥
--enable-dav --enable-dav-fs --enable-dav-lock ¥
--enable-mods-shared --enable-rewrite=shared --enable-speling=shared
make とmake installを済ませる。
ここ以降はApacheじゃなくてPHPについての作業
9. cd ../php-NN
10. Now, configure your PHP. This is where you customize your PHP
with various options, like which extensions will be enabled. Do a
./configure --help for a list of available options. In our example
we'll do a simple configure with Apache 2 and MySQL support. Your
path to apxs may differ, in fact, the binary may even be named apxs2 on
your system.
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
我が家のPHPのconfigureオプション
./configure ¥
--prefix=/opt/php5 --with-apxs2=/opt/httpd22/bin/apxs --enable-soap
LIBXML supportがデフォルトでyesなので
libxmlがないとコンパイルできなかった。
http://www.openbsd.org/3.8_packages/i386/libxml-2.6.16p5.tgz-long.html
(多分どれかをdisableにしちゃえばいいのだろうけど)
pkg_addでインストール。
11. make
さいごにこんなのが出る。
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
12. make install
If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.
Note that unless told otherwise, 'make install' will also install PEAR,
various PHP tools such as phpize, install the PHP CLI, and more.
太字の箇所のこんなのが出る?
# make install
Installing PHP SAPI module: apache2handler
/opt/httpd22/build/instdso.sh SH_LIBTOOL='/opt/httpd22/build/libtool' libphp5.la /opt/httpd22/modules
/opt/httpd22/build/libtool --mode=install cp libphp5.la /opt/httpd22/modules/
cp .libs/libphp5.so /opt/httpd22/modules/libphp5.so
cp .libs/libphp5.lai /opt/httpd22/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /sourcedir/php-5.1.4/libs'
chmod 755 /opt/httpd22/modules/libphp5.so
[activating module `php5' in /opt/httpd22/conf/httpd.conf]
Installing PHP CLI binary: /opt/php5/bin/
Installing PHP CLI man page: /opt/php5/man/man1/
Installing build environment: /opt/php5/lib/php/build/
Installing header files: /opt/php5/include/php/
Installing helper programs: /opt/php5/bin/
program: phpize
program: php-config
Installing man pages: /opt/php5/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/php5/lib/php/
[PEAR] Archive_Tar - installed: 1.3.1
[PEAR] Console_Getopt - installed: 1.2
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR - installed: 1.4.9
Wrote PEAR system config file at: /opt/php5/etc/pear.conf
You may want to add: /opt/php5/lib/php to your php.ini include_path
Installing PDO headers: /opt/php5/include/php/ext/pdo/
もし出たら、絶対に実行すること。
httpd.confでphpをLoadModuleしたとき、Apache自体が起動できない。
ポイントはapachectl startの戻り値が4で終わる状況か。
モジュールがうまく作れてないと4で終わるっぽい。(ldconfigがかかわっている
ところのはずなんだが。詳しい人おしえて)
# ./libtool --finish /sourcedir/php-5.1.4/libs
PATH="$PATH:/sbin" ldconfig -m /sourcedir/php-5.1.4/libs
----------------------------------------------------------------------
Libraries have been installed in:
/sourcedir/php-5.1.4/libs
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- use the `-Wl,-rpath,LIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
13. Setup your php.ini
cp php.ini-dist /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having
php.ini in another location, use --with-config-file-path=/some/path in
step 10.
If you instead choose php.ini-recommended, be certain to read the list
of changes within, as they affect how PHP behaves.
php.ini-distを (phpの)--with-config-file-pathで指定したパスへ
php.iniという名前でコピーしろと。php.ini-recommendedには今は触れない
phpの ./configure --helpをみると
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
...
--with-config-file-path=PATH
Set the path in which to look for php.ini
[PREFIX/lib]
なので
--prefixを指定し、
--with-config-file-pathは指定していない場合は、
`--prefixで指定したパス'/lib/ がphp.iniの置き場所となる
我が家では、
# cp php.ini-dist /opt/php5/lib/php.ini
mbstring周りを適当に日本語EUCJPになるようにしておく。
しなくてもいいかも。
14. Edit your httpd.conf to load the PHP module. The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have already
added this for you, but be sure to check.
LoadModule php5_module modules/libphp5.so
この行があることを確認する。
今回の例だと/opt/httpd22/conf/httpd.confを確認する
あった。
15. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.
AddType application/x-httpd-php .php .phtml
こうやってApacheにphpスクリプトの拡張子を教えなさいねと。
ディレクティブに同じような記載があるので追加
16. Use your normal procedure for starting the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start

PHPによるWebアプリケーションスーパーサンプル 第2版
西沢 直木
ディス鶏付きのPHPやApacheじゃなくて
どちらもソースからコンパイルする。
その他はどうなっても知らん。
0 準備
それぞれソースを取ってくる。
形式にあわせて展開
Apache HTTP Server 2.2.2
http://httpd.apache.org/download.cgi
~/httpd-2.2.2/
PHP 5.1.4
http://www.php.net/downloads.php
~/php-5.1.4/
-- 覚悟完了 --
Beginning Php5, Apache, Mysql Web Development (Programmer to Programmer)
Michael K. Glass,Yann Le Scouarnec,Jason Gerner,Jeremy Stolz
PHPのテキストをみてapache側を設定する
php-5.1.4/INSTALLの
Apache 2.0 on Unix systemsと 2.0.x向けの方にあわせてやってみる。
Example 2-4. Installation Instructions (Apache 2 Shared Module
Version)
1. gzip -d httpd-2_0_NN.tar.gz
2. tar xvf httpd-2_0_NN.tar
3. gunzip php-NN.tar.gz
4. tar -xvf php-NN.tar
5. cd httpd-2_0_NN
6. ./configure --enable-so
7. make
8. make install
1,2,3,4まではバッチりです。
6ではApacheのconfigureで--enable-soしろとある。
んでメイク。
我が家のApacheのconfigureオプション
./configure ¥
--prefix=/opt/httpd22 --enable-so --enable-threads ¥
--enable-dav --enable-dav-fs --enable-dav-lock ¥
--enable-mods-shared --enable-rewrite=shared --enable-speling=shared
make とmake installを済ませる。
ここ以降はApacheじゃなくてPHPについての作業
9. cd ../php-NN
10. Now, configure your PHP. This is where you customize your PHP
with various options, like which extensions will be enabled. Do a
./configure --help for a list of available options. In our example
we'll do a simple configure with Apache 2 and MySQL support. Your
path to apxs may differ, in fact, the binary may even be named apxs2 on
your system.
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql
我が家のPHPのconfigureオプション
./configure ¥
--prefix=/opt/php5 --with-apxs2=/opt/httpd22/bin/apxs --enable-soap
LIBXML supportがデフォルトでyesなので
libxmlがないとコンパイルできなかった。
http://www.openbsd.org/3.8_packages/i386/libxml-2.6.16p5.tgz-long.html
(多分どれかをdisableにしちゃえばいいのだろうけど)
pkg_addでインストール。
11. make
さいごにこんなのが出る。
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
12. make install
If you decide to change your configure options after installation,
you only need to repeat the last three steps. You only need to
restart apache for the new module to take effect. A recompile of
Apache is not needed.
Note that unless told otherwise, 'make install' will also install PEAR,
various PHP tools such as phpize, install the PHP CLI, and more.
太字の箇所のこんなのが出る?
# make install
Installing PHP SAPI module: apache2handler
/opt/httpd22/build/instdso.sh SH_LIBTOOL='/opt/httpd22/build/libtool' libphp5.la /opt/httpd22/modules
/opt/httpd22/build/libtool --mode=install cp libphp5.la /opt/httpd22/modules/
cp .libs/libphp5.so /opt/httpd22/modules/libphp5.so
cp .libs/libphp5.lai /opt/httpd22/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /sourcedir/php-5.1.4/libs'
chmod 755 /opt/httpd22/modules/libphp5.so
[activating module `php5' in /opt/httpd22/conf/httpd.conf]
Installing PHP CLI binary: /opt/php5/bin/
Installing PHP CLI man page: /opt/php5/man/man1/
Installing build environment: /opt/php5/lib/php/build/
Installing header files: /opt/php5/include/php/
Installing helper programs: /opt/php5/bin/
program: phpize
program: php-config
Installing man pages: /opt/php5/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /opt/php5/lib/php/
[PEAR] Archive_Tar - installed: 1.3.1
[PEAR] Console_Getopt - installed: 1.2
pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
[PEAR] PEAR - installed: 1.4.9
Wrote PEAR system config file at: /opt/php5/etc/pear.conf
You may want to add: /opt/php5/lib/php to your php.ini include_path
Installing PDO headers: /opt/php5/include/php/ext/pdo/
もし出たら、絶対に実行すること。
httpd.confでphpをLoadModuleしたとき、Apache自体が起動できない。
ポイントはapachectl startの戻り値が4で終わる状況か。
モジュールがうまく作れてないと4で終わるっぽい。(ldconfigがかかわっている
ところのはずなんだが。詳しい人おしえて)
# ./libtool --finish /sourcedir/php-5.1.4/libs
PATH="$PATH:/sbin" ldconfig -m /sourcedir/php-5.1.4/libs
----------------------------------------------------------------------
Libraries have been installed in:
/sourcedir/php-5.1.4/libs
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- use the `-Wl,-rpath,LIBDIR' linker flag
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
13. Setup your php.ini
cp php.ini-dist /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having
php.ini in another location, use --with-config-file-path=/some/path in
step 10.
If you instead choose php.ini-recommended, be certain to read the list
of changes within, as they affect how PHP behaves.
php.ini-distを (phpの)--with-config-file-pathで指定したパスへ
php.iniという名前でコピーしろと。php.ini-recommendedには今は触れない
phpの ./configure --helpをみると
--prefix=PREFIX install architecture-independent files in PREFIX
[/usr/local]
...
--with-config-file-path=PATH
Set the path in which to look for php.ini
[PREFIX/lib]
なので
--prefixを指定し、
--with-config-file-pathは指定していない場合は、
`--prefixで指定したパス'/lib/ がphp.iniの置き場所となる
我が家では、
# cp php.ini-dist /opt/php5/lib/php.ini
mbstring周りを適当に日本語EUCJPになるようにしておく。
しなくてもいいかも。
14. Edit your httpd.conf to load the PHP module. The path on the right hand
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have already
added this for you, but be sure to check.
LoadModule php5_module modules/libphp5.so
この行があることを確認する。
今回の例だと/opt/httpd22/conf/httpd.confを確認する
あった。
15. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.
AddType application/x-httpd-php .php .phtml
こうやってApacheにphpスクリプトの拡張子を教えなさいねと。
16. Use your normal procedure for starting the Apache server, e.g.:
/usr/local/apache2/bin/apachectl start
PHPによるWebアプリケーションスーパーサンプル 第2版
西沢 直木
コメント
コメントを投稿
「コメントを投稿できるユーザー」の範囲は変更される可能性があります。