FreeBSDにPHPをインストール
前回の続き前提です。
OS | FreeBSD 6.3Release |
---|---|
apache | 2.0.63 |
PHP | 5.2.6 |
ちなみに今回はかなり回りくどく説明しているので後でストレートなやり方を記述しますのでお待ちください。
とりあえずやってみる
ここでconfigureをかけるが
- apache2の共有モジュールを使用する必要があるため --with-apxs2 を適用します
- マルチバイト文字列を使う場合に備え --enable-mbstring を適用します
- 同じくマルチバイト対応正規表現ライブラリを使う場合に備え --enable-mbregex を適用します
ということでErrorになってしまいました。:
:
Sorry, I cannot run apxs. Possible reasons follow:1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)The output of /usr/local/apache2/bin/apxs follows:
./configure: /usr/local/apache2/bin/apxs: not found
configure: error: Aborting
>
——with-apxs2がだめみたいです。
apacheのbuildで--enable-soを付けましょうと言っています。
そこで前回のapacheのsourceがなくなっていれば
apacheをもう一度makeしなおします。
# make install
ということで再び
ということで同じでした。
> cd ~/app/php-5.2.6 (⇒ここにあるという前提で・・・):
:
Sorry, I cannot run apxs. Possible reasons follow:1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)The output of /usr/local/apache2/bin/apxs follows:
./configure: /usr/local/apache2/bin/apxs: not found
configure: error: Aborting
>
と思ったらPerlが入っていないのが悪いみたいでした。
そこで
でインストールされたが:
(永遠といろいろ聞かれます -d を付けると自動になるらしい:未検証)
:(永いです)
# make install
なんじゃこりゃ・・・
# cd /usr/local/bin
# ls
a2p5.9.5 h2xs5.9.5 pod2usage5.9.5
c2ph5.9.5 instmodsh5.9.5 podchecker5.9.5
config_data5.9.5 libnetcfg5.9.5 podselect5.9.5
corelist5.9.5 perl5.9.5 prove5.9.5
cpan2dist5.9.5 perlbug5.9.5 psed5.9.5
cpan5.9.5 perldoc5.9.5 pstruct5.9.5
cpanp-run-perl5.9.5 perlivp5.9.5 ptar5.9.5
cpanp5.9.5 piconv5.9.5 ptardiff5.9.5
dprofpp5.9.5 pl2pm5.9.5 s2p5.9.5
enc2xs5.9.5 pod2html5.9.5 shasum5.9.5
find2perl5.9.5 pod2latex5.9.5 splain5.9.5
gmake pod2man5.9.5 wget
h2ph5.9.5 pod2text5.9.5 xsubpp5.9.5
#
しょうがないのでひとつずつシンボリックリンク張って対処したがきちんとした対処方法は不明・・・
で気を取り直して、PHPのインストールに戻る
ありゃ、変わらない・・・
> cd ~/app/php-5.2.6 (⇒ここにあるという前提で・・・):
:
Sorry, I cannot run apxs. Possible reasons follow:1. Perl is not installed
2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs
3. Apache was not built using --enable-so (the apxs usage page is displayed)The output of /usr/local/apache2/bin/apxs follows:
./configure: /usr/local/apache2/bin/apxs: not found
configure: error: Aborting
>
次のだめな原因はこれらしい
# cd /usr/local/apache2/bin
# vi apxs
perlへのpathがいい加減なのがだめみたいです
#!/replace/with/path/to/perl/interpreter -w
#
:
#!/usr/local/bin/perl -w
#
:
こんどは libxml2 が入ってないとだめらしい・・・
> cd ~/app/php-5.2.6 (⇒ここにあるという前提で・・・):
:
Configuring extensions
checking whether to enable LIBXML support... yes
checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.
>
# make install
こんどは iconv がないらしい
> cd ~/app/php-5.2.6 (⇒ここにあるという前提で・・・):
configure: error: Please specify the install prefix of iconv with --with-iconv=
# make install
ようやく成功しました (@@
> cd ~/app/php-5.2.6 (⇒ここにあるという前提で・・・):
:
- +
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.
>
確認しますsv01# make install
sv01# exit/usr/local/bin/php
PHP 5.2.6 (cli) (built: Sep 20 2008 03:32:37)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
>
さらにapacheにmoduleとして認識させる作業が必要です。
/usr/local/apache2/conf/httpd.confを編集します。
以下を同ファイルに追記します。
AddType application/x-httpd-php .php
とりあえず、以下のようなファイルを作成し公開ディレクトリに置いてみた
結果
php test
<h1> php test </h1>
<hr>
<?php
print "Hellow World php Programing!!";
?>
が出力されればOK
最期、一応
[ wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.9.2.tar.gz [ wget http://ring.aist.go.jp/archives/lang/perl/CPAN/src/perl-5.9.5.tar.gz [ http://www.meisei-u.ac.jp/mirror/apache/httpd/apache_2.0.63.tar.gz [ wget http://ring.aist.go.jp/archives/net/www/php/distributions/php-5.2.6.tar.gz
sv01# cp ~/app/php-5.2.6/php.ini-dist /usr/local/php.ini