ダウンロードサイト
コンパイル&インストール
% tar jxvf php-5.2.6.tar.bz2
% cd php-5.2.6
% ./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-discard-path --with-libxml-dir=/usr/local --with-openssl=/usr/local --with-zlib --with-zlib-dir=/usr/local --with-bz2=/usr --enable-calendar --enable-dba --with-gdbm=/usr/local --with-db4=/usr/local --enable-ftp --with-openssl-dir=/usr/local --with-gd=/usr/local --with-jpeg-dir=/usr/local --with-png-dir=/usr/local --with-zlib-dir=/usr/local --with-xpm-dir=/usr/openwin --with-freetype-dir=/usr/local --with-gettext=/usr/local --with-imap=/usr/local --with-imap-ssl=/usr/local --with-ldap=/usr/local --with-ldap-sasl=/usr/local --enable-mbstring --with-mcrypt=/usr/local --with-mhash=/usr/local --with-mysql=/usr/local --with-pgsql=/usr/local --with-readline=/usr/local --with-mm --enable-sockets --enable-sqlite-utf8 --with-iconv-dir=/usr/local --enable-zip --with-snmp=/usr/local --enable-ucd-snmp-hack --enable-debug
% make
% su
# make install
# cp php.ini-dist /usr/local/lib/php.ini
コンフィグレーション
# vi /etc/apache/httpd.conf
下記を追記。
#
# PHP
#
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# vi /usr/local/lib/php.ini
--- php.ini-dist 2007-09-11 17:27:29.000000000 +0900
+++ php.ini 2007-09-11 17:32:52.000000000 +0900
@@ -245,7 +245,7 @@
; (e.g. by adding its signature to the Web server header). It is no security
; threat in any way, but it makes it possible to determine whether you use PHP
; on your server or not.
-expose_php = On
+expose_php = Off
;;;;;;;;;;;;;;;;;;;
@@ -319,7 +319,7 @@
;
; stdout (On) - Display errors to STDOUT
;
-display_errors = On
+display_errors = Off
; Even when display_errors is on, errors that occur during PHP's startup
; sequence are not displayed. It's strongly recommended to keep
@@ -329,7 +329,7 @@
; Log errors into a log file (server-specific log, stderr, or error_log (below))
; As stated above, you're strongly advised to use error logging in place of
; error displaying on production web sites.
-log_errors = Off
+log_errors = On
; Set maximum length of log_errors. In error_log information about the source is
; added. The default is 1024 and 0 allows to not apply any maximum length at all.
@@ -375,7 +375,7 @@
;error_append_string = "</font>"
; Log errors to specified file.
-;error_log = filename
+error_log = /usr/local/apache2/logs/error_log
; Log errors to syslog (Event Log on NT, not valid in Windows 95).
;error_log = syslog
@@ -541,7 +541,7 @@
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
-;upload_tmp_dir =
+upload_tmp_dir = /tmp
; Maximum allowed size for uploaded files.
upload_max_filesize = 2M
@@ -654,7 +654,7 @@
[Date]
; Defines the default timezone used by the date functions
-;date.timezone =
+date.timezone = Asia/Tokyo
;date.default_latitude = 31.7667
;date.default_longitude = 35.2333
@@ -1186,34 +1186,34 @@
[mbstring]
; language for internal character representation.
-;mbstring.language = Japanese
+mbstring.language = Japanese
; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
-;mbstring.internal_encoding = EUC-JP
+mbstring.internal_encoding = EUC-JP
; http input encoding.
-;mbstring.http_input = auto
+mbstring.http_input = auto
; http output encoding. mb_output_handler must be
; registered as output buffer to function
-;mbstring.http_output = SJIS
+mbstring.http_output = EUC-JP
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
-;mbstring.encoding_translation = Off
+mbstring.encoding_translation = On
; automatic encoding detection order.
; auto means
-;mbstring.detect_order = auto
+mbstring.detect_order = auto
; substitute_character used when character cannot be converted
; one from another
-;mbstring.substitute_character = none;
+mbstring.substitute_character = none;
; overload(replace) single byte functions by mbstring functions.
; mail(), ereg(), etc are overloaded by mb_send_mail(), mb_ereg(),
Apache 再起動
# /usr/local/apache2/bin/apachectl start