CentOS4.5で Apache2.2 + PHP5.2 [3]

さて、本題のPHP
apxsとmagicの場所が変わったのでPHPを再コンパイル

ついでにCGI版にする。

# ./configure --program-prefix= \
              --prefix=/usr \
              --exec-prefix=/usr \
              --with-pic \
              --with-pear \
              --with-bz2 \
              --with-curl \
              --with-png-dir=/usr \
              --enable-gd-native-ttf \
              --with-gettext \
              --with-gmp \
              --with-iconv \
              --with-jpeg-dir=/usr/lib \
              --with-openssl \
              --with-zlib \
              --enable-exif \
              --enable-ftp \
              --enable-magic-quotes \
              --enable-sockets \
              --with-kerberos \
              --enable-calendar \
              --with-mime-magic=/usr/local/httpd/conf/magic \
              --with-sqlite \
              --with-libxml-dir=/usr \
              --with-apxs2=/usr/local/httpd/bin/apxs \
              --with-mysql \
              --with-gd \
              --enable-zend-multibyte \
              --enable-mbstring \
              --enable-mbregex \
              --enable-cgi
...
# make clean
...
# make
...
# checkinstall
...
# rpm -i /usr/src/redhat/RPMS/i386php-5.2.9-1.i386.rpm
        file /usr/bin/php from install of php-5.2.9-1 conflicts with file from package php-cli-5.1.6-3.el4s1.10

現在動いているPHPのタイプを確認してみる。

# php -v
PHP 5.1.6 (cli) (built: Jul 31 2008 00:08:07)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies

ああ、CLI版なのね。

# yum remove php-cli
# rpm -i /usr/src/redhat/RPMS/i386php-5.2.9-1.i386.rpm

エラーが出なかったので、バージョンを確認。

# php -v
PHP 5.2.9 (cli) (built: Mar 27 2009 12:28:08)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

ヤッター!

conf/httpd.confに

LoadModule php5_module modules/libphp5.so

が増えていることを確認して(mod_php5.soを必死になって探したけど、名前変わってた・・・libphp5.soになったらしい)、

/usr/local/httpd/bin/apachectl restart

phpMyAdminをさっき削除したので、再インストール。

yum install phpmyadmin

conf/httpd.confのディレクティブの中に、

### phpMyAdmin
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
Alias /myphpadmin /usr/share/phpMyAdmin

conf/extra/http-userdir.confの中に、

### phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
Order allow,deny
Allow from all
</Directory>

<Directory /usr/share/phpMyAdmin/libraries>
Order allow,deny
Allow from All
</Directory>

を追記してApacheを再起動。
「allow,deny」の部分は、

  • 「allow, deny」のようにスペースを入れたり
  • 「Allow,Deny」のように大文字にしたり

・・・すると、エラーになるので注意。今更ながら知らんかった。
よし、完了!