VineLinux3.x/Apache2.2/PHP5のインストール

Last-modified: 2018-02-03 (土) 09:34:02 (2267d)

概要

Apache2.2にPHP5.1.4をインストールします。

設定手順

ダウンロード&解凍

# wget http://jp2.php.net/get/php-5.1.4.tar.gz/from/jp.php.net/mirror
16:20:53 (2.03 MB/s) - `php-5.1.4.tar.gz' を保存しました [8109575/8109575]
# tar zxf php-5.1.4.tar.gz
# cd php-5.1.4

以下のパッケージを入れておく

# apt-get install flex \
bzip2-devel \
libjpeg-devel \
libpng-devel \
libxml2-devel \
MySQL-server \
MySQL-devel \
t1lib-devel \
zlib-devel

インストール

# ./configure \
--prefix=/usr \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-config-file-path=/etc \
--with-mysql=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--with-bz2 \
--with-openssl \
--with-gd \
--with-t1lib \
--with-ttf \
--enable-exif \
--enable-mbregex \
--enable-mbstring \
--enable-zend-multibyte \
--enable-gd-jis-conv \
--enable-gd-native-ttf
# make
# make install

設定ファイルのコピー

# cp php.ini-dist /etc/php.ini

設定ファイルの編集

# vi /etc/php.ini
output_buffering = On
output_handler = mb_output_handler
magic_quotes_gpc = Off

apacheの設定ファイルに以下を追加

# vi /usr/local/apache2/conf/httpd.conf
   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps

apache再起動

# /etc/init.d/apache2 restart
httpdを停止中:                                             [  OK  ]
httpdを起動中:                                             [  OK  ]

動作確認。以下の内容のphpファイルをドキュメントルートにおいてアクセス。うまくいけば設定情報が見れるはずだ!

# vi /home/httpd/html/info.php
<?php phpinfo() ?>

コメント