|
PHP5.2.6をApache2.2.8にインストールする
PHP5.2.6をApache2.2.8にインストールする
0.改訂履歴
1.はじめに
このドキュメントでは,PHPをインストールする際に,Apache2のmpm=workerに対応したマルチスレッド対応で,OpenSSL
および画像変換エンジンのいgdと,それらに関係する圧縮ライブラリのzlib,JPEGやPNGのライブラリであるlibjpegやlibpngをコン
パイルエラーの出ない様にインストールし,外部との通信を行うcURLやFTPも利用できる様にコンパイルを行う.
また,インストール後はphpinfo等を使った動作および環境の確認,libphp5.soを使ってのhttpd.confを編集しての
Apacheとの連携の確認,php.iniのテンプレートからの作成や,セキュリティ向上およびUTF-8をベースに解説をしながらmbstring系
の各個別設定手順,最後にMySQLiインタフェイスを使ってのデータベースとの接続稼働テストまでを説明する.
- モジュールの入手
- 追加モジュールをインストール(libxml,zlib,libjpeg,libpng,libidn,curl)
- PHPのインストール(configure,make install)
- インストールの確認(phpinfo)
- Apacheとの連携の確認
- PHP.INIの確認
- セキュリティ向上の為のPHPバナーオフ
- セキュリティ向上の為のmagic_quotes_gpc設定
- 日本語設定(mbstring)
- MySQLiインタフェイスを使ってMySQLに接続確認
なお,この手順では,OpenSSLのインストールについては記載していない.
2.モジュールの入手
- まずは,英語環境にしておく.
- これは特に理由はないが,いかに理由による.
- コンパイル時に日本語がでると気持ち悪い.(個人的見解)
- これで失敗した事が無い
[root@ujpdev1 InstallBin]# export LANG=C [root@ujpdev1 InstallBin]#
|
[root@ujpdev1 InstallBin]# wget http://jp.php.net/get/php-5.2.6.tar.gz/from/this/ mirror --17:31:48-- http://jp.php.net/get/php-5.2.6.tar.gz/from/this/mirror Resolving jp.php.net... 61.195.146.164 Connecting to jp.php.net|61.195.146.164|:80... connected. HTTP request sent, awaiting response... 302 Found Location: http://jp.php.net/distributions/php-5.2.6.tar.gz [following] --17:31:48-- http://jp.php.net/distributions/php-5.2.6.tar.gz Connecting to jp.php.net|61.195.146.164|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 12046184 (11M) [application/x-gzip] Saving to: `php-5.2.6.tar.gz'
100%[=========================================================================== =>] 12,046,184 4.54M/s in 2.5s
17:31:51 (4.54 MB/s) - `php-5.2.6.tar.gz' saved [12046184/12046184]
[root@ujpdev1 InstallBin]#
|
[root@ujpdev1 InstallBin]# tar xfz php-5.2.6.tar.gz [root@ujpdev1 InstallBin]#
|
[root@ujpdev1 InstallBin]# cd php-5.2.6
[root@ujpdev1 php-5.2.6]# ls -1
CODING_STANDARDS
CREDITS
EXTENSIONS
INSTALL
LICENSE
Makefile.frag
Makefile.gcov
Makefile.global
NEWS
README.CVS-RULES
README.EXTENSIONS
README.EXT_SKEL
README.PARAMETER_PARSING_API
README.PHP4-TO-PHP5-THIN-CHANGES
README.QNX
README.SELF-CONTAINED-EXTENSIONS
README.STREAMS
README.SUBMITTING_PATCH
README.TESTING
README.TESTING2
README.UNIX-BUILD-SYSTEM
README.UPDATE_5_2
README.WIN32-BUILD-SYSTEM
README.Zeus
README.input_filter
TODO
TODO-5.1
TODO-PHP5
TSRM
UPGRADING
Zend
acconfig.h
acconfig.h.in
acinclude.m4
aclocal.m4
build
buildconf
buildconf.bat
config.guess
config.sub
configure
configure.in
cvsclean
cvsclean.bat
ext
footer
generated_lists
genfiles
header
install-sh
ltmain.sh
main
makedist
makerpm
missing
mkinstalldirs
netware
pear
php.gif
php.ini-dist
php.ini-recommended
php5.spec.in
regex
run-tests.php
sapi
scripts
server-tests-config.php
server-tests.php
snapshot
stamp-h.in
stub.c
tests
win32
[root@ujpdev1 php-5.2.6]#
|
- Apacheのapxsが入っているディレクトリを確認する.
- apxsとは,Apache eXtenSiion toolの事で,PHP等をApacheの中から利用できるようにApacheを拡張するツール.
- apxs - APache eXtenSion tool
[root@ujpdev1 php-5.2.6]# ls -la /usr/local/apache2/bin/apxs
-rwxr-xr-x 1 root root 22597 Jun 2 17:36 /usr/local/apache2/bin/apxs
[root@ujpdev1 php-5.2.6]#
|
- apxsがあったので,Apacheがインストールされている事が確認できた.
- なお,RPM等でインストールされている場合には,上記のディレクトリと異なる場所に存在している事があるので,見つからない場合は,locateコマンド等で探す.
3.追加モジュールをインストールする
- libxmlモジュールをインストールする.
- まずは,モジュールのバージョンを確認する.
[root@ujpdev1 InstallBin]# ls -la libxml*
-rw-r--r-- 1 root root 816942 Jun 2 19:08 libxml2-2.6.26-2.1.2.1.i386.rpm
-rw-r--r-- 1 root root 2225764 Jun 2 19:12 libxml2-devel-2.6.26-2.1.2.1.i386.rpm
[root@ujpdev1 InstallBin]#
|
- libxml関連モジュールは,既にインストールされており,バージョンアップとなるので-Uでアップグレードを行う.
[root@ujpdev1 InstallBin]# rpm -Uhv libxml2-2.6.26-2.1.2.1.i386.rpm
Preparing... ########################################### [100%]
1:libxml2 ########################################### [100%]
[root@ujpdev1 InstallBin]#
|
- 次に開発用ライブラリをインストールする.これが無いとヘッダファイルが無いのでPHPモジュールのインストールができない場合がある.
[root@ujpdev1 InstallBin]# rpm -Uhv libxml2-devel-2.6.26-2.1.2.1.i386.rpm
Preparing... ########################################### [100%]
1:libxml2-devel ########################################### [100%]
[root@ujpdev1 InstallBin]#
|
- 次に,圧縮用ライブラリのzlibをインストールする.
[root@ujpdev1 base]# rpm -ihv zlib-devel-1.2.3-3.i386.rpm
warning: zlib-devel-1.2.3-3.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:zlib-devel ########################################### [100%]
[root@ujpdev1 base]#
|
- 次に,JPEG用の開発用ライブラリをインストールする.
- このdevelパッケージが入っていないと,libjpeg.soへのリンクが作成されないでコンパイル時に困る.
- なお,libjpeg本体は,もともとOSでインストールされているものを利用しているが,新しいバージョンが出ていればそれを適用しても良い.
[root@ujpdev1 libJPEG]# rpm -ihv libjpeg-devel-6b-37.i386.rpm
warning: libjpeg-devel-6b-37.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897
Preparing... ########################################### [100%]
1:libjpeg-devel ########################################### [100%]
[root@ujpdev1 libJPEG]#
|
[root@ujpdev1 libJPEG]# rpm -Uhv libpng-1.2.10-7.1.el5_0.1.i386.rpm
warning: libpng-1.2.10-7.1.el5_0.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e85 62897 Preparing... ########################################### [100%] 1:libpng ########################################### [100%] [root@ujpdev1 libJPEG]#
|
- libjpegと同じ様に,PHPのコンパイル時にlibpng.soへのリンクが必要なのでインストールする.
[root@ujpdev1 libJPEG]# rpm -ihv libpng-devel-1.2.10-7.1.el5_0.1.i386.rpm
warning: libpng-devel-1.2.10-7.1.el5_0.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562897 Preparing... ########################################### [100%] 1:libpng-devel ########################################### [100%] [root@ujpdev1 libJPEG]#
|
- 次に,libidnをインストールする.
- このライブラリは,GNU IDNのライブラリで,国際化ドメイン名(IDN:Internationalized Domain Names)ワークグループによって定義された規格のCライブラリ.
- とりあえずCURLを使う為に必要.
[root@ujpdev1 CURL]# rpm -ihv libidn-devel-0.6.5-1.1.i386.rpm warning: libidn-devel-0.6.5-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID e8562 897 Preparing... ########################################### [100%] 1:libidn-devel ########################################### [100%] [root@ujpdev1 CURL]#
|
[root@ujpdev1 CURL]# rpm -ihv curl-devel-7.15.5-2.el5.i386.rpm warning: curl-devel-7.15.5-2.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID e856 2897 Preparing... ########################################### [100%] 1:curl-devel ########################################### [100%] [root@ujpdev1 CURL]#
|
- これで今回必要なパッケージは事前にインストールできた.
4.PHPのインストール(configure,make install)
- 今回は,次の様なオプションをつけてインストールする.
オプション |
説明 |
--with-apxs2 |
Apache2を使う為. |
--enable-mbstring |
日本語を利用する. |
--enable-mbregex |
日本語の正規表現を利用する. |
--with-mysqli |
MySQLiインタフェイスを利用する. |
--without-MySQL |
旧MySQLインタフェイスを利用しない |
--with-gd |
画像処理をするGDを利用する. |
--with-zlib |
画像処理で圧縮展開で利用するライブラリ. |
--with-jpeg-dir |
libjpegライブラリのインストールされている場所を指定. |
--with-png-dir |
libpngライブラリのインストールされている場所を指定. |
--with-ttf |
True Typeフォント1を利用する. |
--enable-ftp |
FTPを利用する. |
--with-curl |
cURLを利用する. |
--with-openssl |
OpenSSLを利用する. |
--enable-roxen-zts |
Apache2にて,mpworkerプロセスでコンパイルされている場合に指定. |
- 実際に投入するconfigureコマンドは,以下の通り.
コピペ用
./configure --with-apxs2=/usr/local/apache2/bin/apxs --enable-mbstring --enable-mbregex --with-mysqli=/usr/bin/mysql_config --without-MySQL --with-gd --with-zlib --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ --with-ttf --enable-ftp --with-openssl --with-curl --enable-roxen-zts
|
[root@ujpdev1 php-5.2.6]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs -- enable-mbstring --enable-mbregex --with-mysqli=/usr/bin/mysql_config --without- MySQL --with-gd --with-zlib --with-jpeg-dir=/usr/lib/ --with-png-dir=/usr/lib/ - -with-ttf --enable-ftp --with-curl --with-openssl --enable-roxen-zts creating cache ./config.cache checking for Cygwin environment... no checking for mingw32 environment... no checking for egrep... grep -E checking for a sed that does not truncate output... /bin/sed checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking how to run the C preprocessor... gcc -E checking for icc... no checking whether gcc and cc understand -c and -o together... yes checking how to run the C preprocessor... gcc -E checking for AIX... no checking whether ln -s works... yes checking for system library directory... lib checking whether to enable runpaths... yes checking if compiler supports -R... no checking if compiler supports -Wl,-rpath,... yes checking for re2c... no configure: warning: You will need re2c 0.12.0 or later if you want to regenerate PHP parsers. checking for gawk... gawk checking for bison... no checking for byacc... no checking for bison version... invalid configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 (found: none). checking for flex... lex checking for yywrap in -ll... no checking for working const... yes configure: warning: flex versions supported for regeneration of the Zend/PHP parsers: 2.5.4 (found: none) checking whether to force non-PIC code in shared modules... yes checking whether /dev/urandom exists... yes checking for pthreads_cflags... -pthread checking for pthreads_lib...
Configuring SAPI modules checking for AOLserver support... no checking for Apache 1.x module support via DSO through APXS... no checking for Apache 1.x module support... no checking whether to enable Apache charset compatibility option... no checking for Apache 2.0 filter-module support via DSO through APXS... no checking for Apache 2.0 handler-module support via DSO through APXS... yes checking for Apache 1.x (hooks) module support via DSO through APXS... no checking for Apache 1.x (hooks) module support... no checking whether to enable Apache charset compatibility option... no checking for Caudium support... no checking for CLI build... yes checking for Continuity support... no checking for embedded SAPI library support... no checking for Zeus ISAPI support... no checking for Milter support... no checking for NSAPI support... no checking for PHTTPD support... no checking for Pi3Web support... no checking whether Roxen module is build using ZTS... yes checking for Roxen/Pike support... checking for thttpd... no checking for TUX... no checking for webjames... no checking for chosen SAPI module... apache2handler
Running system checks checking for sendmail... /usr/sbin/sendmail checking whether system uses EBCDIC... no checking whether byte ordering is bigendian... no checking whether writing to stdout works... This is the test message -- yes checking for socket... yes checking for socketpair... yes checking for htonl... yes checking for gethostname... yes checking for gethostbyaddr... yes checking for yp_get_default_domain... no checking for __yp_get_default_domain... no checking for yp_get_default_domain in -lnsl... yes checking for dlopen... no checking for __dlopen... no checking for dlopen in -ldl... yes checking for sin in -lm... yes checking for res_search... no checking for __res_search... no checking for res_search in -lresolv... yes checking for inet_aton... yes checking for dn_skipname... no checking for __dn_skipname... yes checking for ANSI C header files... yes checking for dirent.h that defines DIR... yes checking for opendir in -ldir... no checking for inttypes.h... yes checking for stdint.h... yes checking for dirent.h... yes checking for ApplicationServices/ApplicationServices.h... no checking for sys/param.h... yes checking for sys/types.h... yes checking for sys/time.h... yes checking for netinet/in.h... yes checking for alloca.h... yes checking for arpa/inet.h... yes checking for arpa/nameser.h... yes checking for assert.h... yes checking for crypt.h... yes checking for fcntl.h... yes checking for grp.h... yes checking for ieeefp.h... no checking for langinfo.h... yes checking for limits.h... yes checking for locale.h... yes checking for monetary.h... yes checking for mach-o/dyld.h... no checking for netdb.h... yes checking for pwd.h... yes checking for resolv.h... yes checking for signal.h... yes checking for stdarg.h... yes checking for stdlib.h... yes checking for string.h... yes checking for syslog.h... yes checking for sysexits.h... yes checking for sys/ioctl.h... yes checking for sys/file.h... yes checking for sys/mman.h... yes checking for sys/mount.h... yes checking for sys/poll.h... yes checking for sys/resource.h... yes checking for sys/select.h... yes checking for sys/socket.h... yes checking for sys/stat.h... yes checking for sys/statfs.h... yes checking for sys/statvfs.h... yes checking for sys/vfs.h... yes checking for sys/sysexits.h... no checking for sys/varargs.h... no checking for sys/wait.h... yes checking for sys/loadavg.h... no checking for termios.h... yes checking for unistd.h... yes checking for unix.h... no checking for utime.h... yes checking for sys/utsname.h... yes checking for sys/ipc.h... yes checking for dlfcn.h... yes checking for assert.h... (cached) yes checking for fopencookie... yes checking for broken getcwd... no checking for broken libc stdio... yes checking whether struct tm is in sys/time.h or time.h... time.h checking for tm_zone in struct tm... yes checking for missing declarations of reentrant functions... done checking for fclose declaration... ok checking for tm_gmtoff in struct tm... yes checking for struct flock... yes checking for socklen_t... yes checking size of size_t... 4 checking size of long long... 8 checking size of long long int... 8 checking size of long... 4 checking size of int... 4 checking size of intmax_t... 8 checking size of ssize_t... 4 checking size of ptrdiff_t... 4 checking for st_blksize in struct stat... yes checking for st_blocks in struct stat... yes checking for st_rdev in struct stat... yes checking for size_t... yes checking for uid_t in sys/types.h... yes checking for struct sockaddr_storage... yes checking for field sa_len in struct sockaddr... no checking for IPv6 support... yes checking for vprintf... yes checking for alphasort... yes checking for asctime_r... yes checking for chroot... yes checking for ctime_r... yes checking for cuserid... yes checking for crypt... no checking for flock... yes checking for ftok... yes checking for funopen... no checking for gai_strerror... yes checking for gcvt... yes checking for getloadavg... yes checking for getlogin... yes checking for getprotobyname... yes checking for getprotobynumber... yes checking for getservbyname... yes checking for getservbyport... yes checking for getrusage... yes checking for gettimeofday... yes checking for gmtime_r... yes checking for getpwnam_r... yes checking for getgrnam_r... yes checking for getpwuid_r... yes checking for grantpt... yes checking for inet_ntoa... yes checking for inet_ntop... yes checking for inet_pton... yes checking for isascii... yes checking for link... yes checking for localtime_r... yes checking for lockf... yes checking for lchown... yes checking for lrand48... yes checking for memcpy... yes checking for memmove... yes checking for mkstemp... yes checking for mmap... yes checking for nl_langinfo... yes checking for perror... yes checking for poll... yes checking for ptsname... yes checking for putenv... yes checking for realpath... yes checking for random... yes checking for rand_r... yes checking for regcomp... yes checking for res_search... (cached) yes checking for scandir... yes checking for setitimer... yes checking for setlocale... yes checking for localeconv... yes checking for setenv... yes checking for setpgid... yes checking for setsockopt... yes checking for setvbuf... yes checking for shutdown... yes checking for sin... yes checking for snprintf... yes checking for srand48... yes checking for srandom... yes checking for statfs... yes checking for statvfs... yes checking for std_syslog... no checking for strcasecmp... yes checking for strcoll... yes checking for strdup... yes checking for strerror... yes checking for strftime... yes checking for strptime... yes checking for strstr... yes checking for strtok_r... yes checking for symlink... yes checking for tempnam... yes checking for tzset... yes checking for unlockpt... yes checking for unsetenv... yes checking for usleep... yes checking for nanosleep... yes checking for utime... yes checking for vsnprintf... yes checking for getaddrinfo... yes checking for strlcat... no checking for strlcpy... no checking for getopt... yes checking whether utime accepts a null argument... yes checking for working alloca.h... (cached) yes checking for alloca... yes checking for declared timezone... yes checking for type of reentrant time-related functions... POSIX checking for readdir_r... yes checking for type of readdir_r... POSIX checking for in_addr_t... yes checking for crypt_r... no
General settings checking whether to include gcov symbols... no checking whether to include debugging symbols... no checking layout of installed files... PHP checking path to configuration file... DEFAULT checking where to scan for configuration files... checking whether to enable safe mode by default... no checking for safe mode exec dir... /usr/local/php/bin checking whether to enable PHP's own SIGCHLD handler... no checking whether to enable magic quotes by default... no checking whether to explicitly link against libgcc... no checking whether to enable short tags by default... yes checking whether to enable dmalloc... no checking whether to enable IPv6 support... yes checking how big to make fd sets... using system default
Configuring extensions checking whether to enable LIBXML support... yes checking libxml2 install dir... no checking for xml2-config path... /usr/bin/xml2-config checking whether libxml build works... yes
checking for OpenSSL support... yes checking for Kerberos support... no checking for DSA_get_default_method in -lssl... yes checking for pkg-config... /usr/bin/pkg-config checking for PCRE support... yes checking for ZLIB support... yes
checking if the location of ZLIB install directory is defined... no
checking for gzgets in -lz... yes
checking whether to enable bc style precision math functions... no
checking for BZip2 support... no
checking whether to enable calendar conversion support... no
checking whether to enable ctype functions... yes
checking for cURL support... yes
checking if we should use cURL for url streams... no
checking for cURL in default path... found in /usr
checking for cURL 7.10.5 or greater... libcurl 7.15.5
checking for SSL support in libcurl... yes
checking how to run the C preprocessor... gcc -E
checking for openssl support in libcurl... yes
checking for openssl/crypto.h... yes
checking for gnutls support in libcurl... no
checking for curl_easy_perform in -lcurl... yes
checking for curl_version_info in -lcurl... yes
checking for curl_easy_strerror in -lcurl... yes
checking for curl_multi_strerror in -lcurl... yes
checking size of long... (cached) 4
checking size of int... (cached) 4
checking for int32_t... yes
checking for uint32_t... yes
checking for sys/types.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for string.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for strtoll... yes
checking for atoll... yes
checking for strftime... (cached) yes
checking for QDBM support... no
checking for GDBM support... no
checking for NDBM support... no
checking for Berkeley DB4 support... no
checking for Berkeley DB3 support... no
checking for Berkeley DB2 support... no
checking for DB1 support... no
checking for DBM support... no
checking for CDB support... no
checking for INI File support... no
checking for FlatFile support... no
checking whether to enable DBA interface... no
checking whether to enable dbase support... no
checking whether to enable DOM support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking whether to enable EXIF (metadata from images) support... no
checking for FrontBase SQL92 (fbsql) support... no
checking for FDF support... no
checking whether to enable input filter support... yes
checking pcre install prefix... no
checking whether to enable FTP support... yes
checking OpenSSL dir for FTP... no
checking for GD support... yes checking for the location of libjpeg... /usr/lib/ checking for the location of libpng... /usr/lib/ checking for the location of libXpm... no checking for FreeType 1.x support... yes
checking for FreeType 2... no
checking for T1lib support... no
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... yes
checking for floorf... yes
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
If configure fails try --with-freetype-dir=<DIR>
checking for GNU gettext support... no
checking for GNU MP support... no
checking whether to enable hash support... yes
checking whether byte ordering is bigendian... (cached) no
checking size of short... 2
checking size of int... (cached) 4
checking size of long... (cached) 4
checking size of long long... (cached) 8
checking for iconv support... yes
checking for iconv... yes
checking if iconv is glibc's... yes
checking if iconv supports errno... yes
checking if your cpp allows macro usage in include lines... yes
checking for IMAP support... no
checking for IMAP Kerberos support... no
checking for IMAP SSL support... no
checking for InterBase support... no
checking whether to enable JavaScript Object Serialization support... yes
checking for ANSI C header files... (cached) yes
checking for LDAP support... no
checking for LDAP Cyrus SASL support... no
checking whether to enable multibyte string support... yes
checking whether to enable multibyte regex support... yes
checking whether to check multibyte regex backtrack... yes
checking for external libmbfl... no
checking for variable length prototypes and stdarg.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for strings.h... yes
checking for unistd.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for sys/times.h... yes
checking for stdarg.h... (cached) yes
checking size of int... (cached) 4
checking size of short... (cached) 2
checking size of long... (cached) 4
checking for working const... (cached) yes
checking whether time.h and sys/time.h may both be included... yes
checking for working alloca.h... (cached) yes
checking for alloca... (cached) yes
checking for 8-bit clean memcmp... yes
checking for mcrypt support... no
checking for mhash support... no
checking whether to include mime_magic support... no
checking for MING support... no
checking for mSQL support... no
checking for MSSQL support via FreeTDS... no
checking for MySQL support... no
checking for specified location of the MySQL UNIX socket... no
checking for MySQLi support... yes
checking whether to enable embedded MySQLi support... no
checking for mysql_set_server_option in -lmysqlclient_r... yes
checking for mysql_stmt_field_count in -lmysqlclient_r... yes
checking for ncurses support... no
checking for Oracle (OCI8) support... no
checking whether to enable pcntl support... no
checking whether to enable PDO support... yes
checking for PDO_DBLIB support via FreeTDS... no
checking for Firebird support for PDO... no
checking for MySQL support for PDO... no
checking Oracle OCI support for PDO... no
checking for ODBC v3 support for PDO... no
checking for PostgreSQL support for PDO... no
checking for sqlite 3 support for PDO... yes
checking for PDO includes... checking for PDO includes... /InstallBin/php-5.2.6/
ext
checking size of char *... 4
checking for usleep... (cached) yes
checking for nanosleep... (cached) yes
checking for time.h... yes
checking for fdatasync in -lrt... yes
checking for PostgreSQL support... no
checking whether to enable POSIX-like functions... yes
checking for sys/mkdev.h... no
checking for seteuid... yes
checking for setegid... yes
checking for setsid... yes
checking for getsid... yes
checking for setpgid... (cached) yes
checking for getpgid... yes
checking for ctermid... yes
checking for mkfifo... yes
checking for mknod... yes
checking for getrlimit... yes
checking for getlogin... (cached) yes
checking for getgroups... yes
checking for makedev... no
checking for initgroups... yes
checking for getpwuid_r... (cached) yes
checking for getgrgid_r... yes
checking for working ttyname_r() implementation... yes
checking for PSPELL support... no
checking for libedit readline replacement... no
checking for readline support... no
checking for recode support... no
checking whether to enable reflection support... yes
checking whether to enable PHP sessions... yes
checking for mm support... no
checking whether pwrite works... yes
checking whether pread works... yes
checking whether to enable shmop support... no
checking whether to enable SimpleXML support... yes
checking for xml2-config path... (cached) /usr/bin/xml2-config
checking whether libxml build works... (cached) yes
checking for SNMP support... no
checking OpenSSL dir for SNMP... no
checking whether to enable UCD SNMP hack... no
checking whether to enable SOAP support... no
checking whether to enable sockets support... no
checking enable SPL suppport... yes
checking whether zend_object_value is packed... yes
checking for sqlite support... yes
checking whether to enable UTF-8 support in sqlite (default: ISO-8859-1)... no
checking for PDO includes... (cached) /InstallBin/php-5.2.6/ext
checking for lemon... no
configure: warning: lemon versions supported for regeneration of libsqlite
parsers: 1.0 (found: none).
checking size of char *... (cached) 4
checking for usleep... (cached) yes
checking for nanosleep... (cached) yes
checking for time.h... (cached) yes
checking whether flush should be called explicitly after a buffered io... no
checking for crypt in -lcrypt... yes
checking for standard DES crypt... yes
checking for extended DES crypt... no
checking for MD5 crypt... yes
checking for Blowfish crypt... no
checking for getcwd... yes
checking for getwd... yes
checking for asinh... yes
checking for acosh... yes
checking for atanh... yes
checking for log1p... yes
checking for hypot... yes
checking for glob... yes
checking for strfmon... yes
checking for nice... yes
checking for fpclass... no
checking for isinf... yes
checking for isnan... yes
checking for working fnmatch... yes
checking which regex library to use... php
checking whether rounding works as expected... no
checking for fork... yes
checking if your OS can spawn processes with inherited handles... yes
checking for res_nmkquery... no
checking for __res_nmkquery... yes
checking for res_nsend... no
checking for __res_nsend... yes
checking for dn_expand... yes
checking whether atof() accepts NAN... yes
checking whether atof() accepts INF... yes
checking whether HUGE_VAL == INF... yes
checking whether HUGE_VAL + -HUGEVAL == NAN... yes
checking whether strptime() declaration fails... no checking for wchar.h... yes checking for mblen... yes checking for mbrlen... yes checking for mbsinit... yes checking for mbstate_t... yes checking for Sybase support... no checking for Sybase-CT support... no checking whether to enable System V IPC support... no checking whether to enable System V semaphore support... no checking whether to enable System V shared memory support... no checking for TIDY support... no checking whether to enable tokenizer support... yes checking whether to enable WDDX support... no checking libexpat dir for WDDX... no checking whether to enable XML support... yes checking libexpat install dir... no checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking whether to enable XMLReader support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for XMLRPC-EPI support... no checking libexpat dir for XMLRPC-EPI... no checking iconv dir for XMLRPC-EPI... no checking whether to enable XMLWriter support... yes checking for xml2-config path... (cached) /usr/bin/xml2-config checking whether libxml build works... (cached) yes checking for XSL support... no checking for zip archive read/writesupport... no
Configuring PEAR checking whether to install PEAR... yes
Configuring Zend checking for bison version... (cached) invalid configure: warning: bison versions supported for regeneration of the Zend/PHP parsers: 1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3 (found: none). checking for inttypes.h... (cached) yes checking for stdint.h... (cached) yes checking for limits.h... (cached) yes checking for malloc.h... yes checking for string.h... (cached) yes checking for unistd.h... (cached) yes checking for stdarg.h... (cached) yes checking for sys/types.h... (cached) yes checking for sys/time.h... (cached) yes checking for signal.h... (cached) yes checking for unix.h... (cached) no checking for stdlib.h... (cached) yes checking for mach-o/dyld.h... (cached) no checking for dlfcn.h... (cached) yes checking for size_t... (cached) yes checking return type of signal handlers... void checking for uint... yes checking for ulong... yes checking for int32_t... yes checking for uint32_t... yes checking for vprintf... (cached) yes checking for 8-bit clean memcmp... (cached) yes checking for working alloca.h... (cached) yes checking for alloca... (cached) yes checking for memcpy... (cached) yes checking for strdup... (cached) yes checking for getpid... yes checking for kill... yes checking for strtod... yes checking for strtol... yes checking for finite... yes checking for fpclass... (cached) no checking whether sprintf is broken... no checking for finite... (cached) yes checking for isfinite... no checking for isinf... (cached) yes checking for isnan... (cached) yes checking whether fp_except is defined... no checking for dlfcn.h... (cached) yes checking whether dlsym() requires a leading underscore in symbol names... no checking virtual machine dispatch method... CALL checking whether to enable thread-safety... yes checking whether to enable inline optimization for GCC... yes checking whether to enable Zend debugging... no checking whether to enable Zend multibyte... no checking for inline... inline checking target system is Darwin... no checking for MM alignment and log values... done checking for memory allocation using mmap(MAP_ANON)... yes checking for memory allocation using mmap(/dev/zero)... yes checking for mremap... yes
Configuring TSRM checking for stdarg.h... (cached) yes checking for pthreads_cflags... (cached) -pthread checking for pthreads_lib... (cached) checking for POSIX threads... yes
Configuring libtool checking build system type... i686-pc-linux-gnu checking for ld used by /InstallBin/php-5.2.6/meta_ccld... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking how to recognise dependent libraries... pass_all checking for object suffix... o checking for executable suffix... no checking the maximum length of command line arguments... 32768 checking command to parse /usr/bin/nm -B output from /InstallBin/php-5.2.6/meta_ ccld object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if /InstallBin/php-5.2.6/meta_ccld static flag works... yes checking if /InstallBin/php-5.2.6/meta_ccld supports -fno-rtti -fno-exceptions... no checking for /InstallBin/php-5.2.6/meta_ccld option to produce PIC... -fPIC checking if /InstallBin/php-5.2.6/meta_ccld PIC flag -fPIC works... yes checking if /InstallBin/php-5.2.6/meta_ccld supports -c -o file.o... yes checking whether the /InstallBin/php-5.2.6/meta_ccld linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... no
creating libtool appending configuration tag "CXX" to libtool
Generating files updating cache ./config.cache creating ./config.status creating php5.spec creating main/build-defs.h creating scripts/phpize creating scripts/man1/phpize.1 creating scripts/php-config creating scripts/man1/php-config.1 creating sapi/cli/php.1 creating main/php_config.h main/php_config.h is unchanged creating main/internal_functions.c creating main/internal_functions_cli.c +--------------------------------------------------------------------+ | 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.
[root@ujpdev1 php-5.2.6]#
|
- 問題なくconfigureされた模様.
- makeを行う.
[root@ujpdev1 php-5.2.6]# make
/bin/sh /InstallBin/php-5.2.6/libtool --silent --preserve-dup-deps --mode=
compile /InstallBin/php-5.2.6/meta_ccld -Iext/openssl/ -I/InstallBin/php-5.2.6/
ext/openssl/ -DPHP_ATOM_INC -I/InstallBin/php-5.2.6/include -I/InstallBin/php-5.
2.6/main -I/InstallBin/php-5.2.6 -I/usr/include/libxml2 -I/usr/kerberos/include
-I/InstallBin/php-5.2.6/ext/date/lib -I/include -I/InstallBin/php-5.2.6/ext/
mbstring/oniguruma -I/InstallBin/php-5.2.6/ext/mbstring/libmbfl -I/InstallBin/
php-5.2.6/ext/mbstring/libmbfl/mbfl -I/usr/include/mysql -I/InstallBin/php-5.2.6
/TSRM -I/InstallBin/php-5.2.6/Zend -D_REENTRANT -I/usr/include -g -O2 -pthread
-DZTS -prefer-non-pic -c /InstallBin/php-5.2.6/ext/openssl/openssl.c -o ext/
openssl/openssl.lo
/InstallBin/php-5.2.6/ext/openssl/openssl.c: In function 'php_openssl_x509_from_
zval':
/InstallBin/php-5.2.6/ext/openssl/openssl.c:862: warning: passing argument 1 of
'PEM_ASN1_read_bio' from incompatible pointer type
〜略〜
end/zend_exceptions.lo Zend/zend_strtod.lo Zend/zend_objects.lo Zend/zend_object
_handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_
execute.lo sapi/cli/php_cli.lo sapi/cli/php_cli_readline.lo sapi/cli/getopt.lo
main/internal_functions_cli.lo -lcrypt -lcrypt -lrt -lpng -lz -ljpeg -lcurl -lz
-lresolv -lm -ldl -lnsl -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -lgssapi_
krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -ldl -lidn -lssl -lcrypto -lz -lxml2 -
lz -lm -lssl -lcrypto -ldl -lz -lmysqlclient_r -lz -lcrypt -lnsl -lm -lxml2 -lz
-lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -o sapi/cli/
php
Build complete. Don't forget to run 'make test'.
[root@ujpdev1 php-5.2.6]#
|
- 忘れない様にmake testを実施する様に書かれている.
- 現在セットアップしている構成では,4700程度のテストが行われ時間がかかる.
- しかし,始めての構成の場合は確認した方が良いので,テスト実施を推奨する.
- なお,同じ構成で何度もセットアップを経験している場合ははスキップして良い.
[root@ujpdev1 php-5.2.6]# make test
Build complete.
Don't forget to run 'make test'.
=====================================================================
PHP : /InstallBin/php-5.2.6/sapi/cli/php
PHP_SAPI : cli
PHP_VERSION : 5.2.6
ZEND_VERSION: 2.2.0
PHP_OS : Linux - Linux ujpdev1 2.6.18-53.el5 #1 SMP Mon Nov 12 02:22:48 EST
2007 i686
INI actual : /InstallBin/php-5.2.6/tmp-php.ini
More .INIs :
CWD : /InstallBin/php-5.2.6
Extra dirs :
=====================================================================
TIME START 2008-06-03 18:54:45
=====================================================================
PASS EXPECT [tests/run-test/test001.phpt]
PASS EXPECTF [tests/run-test/test002.phpt]
PASS EXPECTREGEX [tests/run-test/test003.phpt]
〜略〜
htmlentities() test 15 (setlocale / KOI8-R) [ext/standard/tests/strings/
htmlentities15.phpt] (warn: possibly braindead libc)
Test vsprintf() function : usage variations - string formats with non-string
values [ext/standard/tests/strings/vsprintf_variation8.phpt]
=====================================================================
You may have found a problem in PHP. We would like to send this report automatically to the PHP QA team, to give us a better understanding of how the test cases are doing. If you don't want to send it immediately, you can choose "s" to save the report to a file that you can send us later. Do you want to send this report now? [Yns]:
|
- テストの結果,何か問題が発見されたようである.
- ここで,Yを選択と,メールアドレスの入力を求められ,PHP開発チームに送られる模様.
- nを選択するとノーリアクション.
- sを選択して,テキストファイルでレポート作成.
o you want to send this report now? [Yns]: s
sh: autoconf: command not found
Please send /InstallBin/php-5.2.6/php_test_results_20080603_1859.txt to qa-
reports@lists.php.net manually, thank you.
[root@ujpdev1 php-5.2.6]#
|
[root@ujpdev1 php-5.2.6]# cat php_test_results_20080603_1859.txt
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt] iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt] Test mb_substr() function : basic functionality [ext/mbstring/tests/mb_substr_basic.php t] Test closedir() function : usage variations - close a file pointer [ext/standard/tests/ dir/closedir_variation3.phpt] Test readdir() function : usage variations - empty directories [ext/standard/tests/dir/ readdir_variation2.phpt] Test readdir() function : usage variations - use file pointers [ext/standard/tests/dir/ readdir_variation7.phpt] Test rewinddir() function : basic functionality [ext/standard/tests/dir/rewinddir_basic .phpt] Test rewinddir() function : usage variations - operate on a closed directory [ext/stand ard/tests/dir/rewinddir_variation2.phpt] Test rewinddir() function : usage variations - file pointers [ext/standard/tests/dir/re winddir_variation3.phpt] Test bindec() - basic function test bindec() [ext/standard/tests/math/bindec_basic.phpt ] htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15) [ext/standard/tests/strings/htmle ntities02.phpt] (warn: possibly braindead libc) htmlentities() test 3 (setlocale / de_DE.ISO-8859-1) [ext/standard/tests/strings/htmlen tities03.phpt] htmlentities() test 15 (setlocale / KOI8-R) [ext/standard/tests/strings/htmlentities15. phpt] (warn: possibly braindead libc) Test vsprintf() function : usage variations - string formats with non-string values [ex t/standard/tests/strings/vsprintf_variation8.phpt] =====================================================================
|
- ICONVは日本語変換系で,利用していなければ無視して問題ないレベルである.
- ちなみに,Bug #16069は,PHP5.2.5時点でレポートされている模様.
- 上記では,問題ないと判断する.
- make installを実行する.
[root@ujpdev1 php-5.2.6]# make install
Installing PHP SAPI module: apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool
' libphp5.la /usr/local/apache2/modules
/usr/local/apache2/build/libtool --mode=install cp libphp5.la /usr/local/apache2
/modules/
cp .libs/libphp5.so /usr/local/apache2/modules/libphp5.so
cp .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la
libtool: install: warning: remember to run `libtool --finish /www/system/
InstallBin/php-5.2.6/libs'
chmod 755 /usr/local/apache2/modules/libphp5.so
[activating module `php5' in /usr/local/apache2/conf/httpd.conf]
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/man/man1/
Installing build environment: /usr/local/lib/php/build/
Installing header files: /usr/local/include/php/
Installing helper programs: /usr/local/bin/
program: phpize
program: php-config
Installing man pages: /usr/local/man/man1/
page: phpize.1
page: php-config.1
Installing PEAR environment: /usr/local/lib/php/
[PEAR] Console_Getopt - already installed: 1.2.3
[PEAR] Archive_Tar - already installed: 1.3.2
[PEAR] Structures_Graph- already installed: 1.0.2
[PEAR] PEAR - already installed: 1.7.1
Wrote PEAR system config file at: /usr/local/etc/pear.conf
You may want to add: /usr/local/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/include/php/ext/pdo/
[root@ujpdev1 php-5.2.6]#
|
5.インストールの確認
[root@ujpdev1 php-5.2.6]# php -v
PHP 5.2.6 (cli) (built: Jun 3 2008 10:26:01) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies [root@ujpdev1 php-5.2.6]#
|
[root@ujpdev1 php-5.2.6]# php -i
phpinfo()
PHP Version => 5.2.6
System => Linux ujpdev1 2.6.18-53.el5 #1 SMP Mon Nov 12 02:22:48 EST 2007 i686
Build Date => Jun 3 2008 11:12:11
Configure Command => './configure' '--with-apxs2=/usr/local/apache2/bin/apxs'
'--enable-mbstring' '--enable-mbregex' '--with-mysqli=/usr/bin/mysql_config' '--
without-MySQL' '--with-gd' '--with-zlib' '--with-jpeg-dir=/usr/lib/' '--with-png
-dir=/usr/lib/' '--with-ttf' '--enable-ftp' '--with-curl' '--enable-roxen-zts'
Server API => Command Line Interface
Virtual Directory Support => enabled
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => (none)
PHP API => 20041225
PHP Extension => 20060613
Zend Extension => 220060519
Debug Build => no
Thread Safety => enabled
Zend Memory Manager => enabled
IPv6 Support => enabled
Registered PHP Streams => php, file, data, http, ftp, compress.zlib
Registered Stream Socket Transports => tcp, udp, unix, udg
Registered Stream Filters => string.rot13, string.toupper, string.tolower,
string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
_______________________________________________________________________
Configuration
PHP Core
Directive => Local Value => Master Value
allow_call_time_pass_reference => On => On
allow_url_fopen => On => On
allow_url_include => Off => Off
always_populate_raw_post_data => Off => Off
arg_separator.input => & => &
arg_separator.output => & => &
asp_tags => Off => Off
auto_append_file => no value => no value
auto_globals_jit => On => On
auto_prepend_file => no value => no value
browscap => no value => no value
default_charset => no value => no value
default_mimetype => text/html => text/html
define_syslog_variables => Off => Off
disable_classes => no value => no value
disable_functions => no value => no value
display_errors => STDOUT => STDOUT
display_startup_errors => Off => Off
doc_root => no value => no value
docref_ext => no value => no value
docref_root => no value => no value
enable_dl => On => On
error_append_string => no value => no value
error_log => no value => no value
error_prepend_string => no value => no value
error_reporting => no value => no value
expose_php => On => On
extension_dir => /usr/local/lib/php/extensions/no-debug-zts-20060613 => /usr/
local/lib/php/extensions/no-debug-zts-20060613
file_uploads => On => On
highlight.bg => <font style="color: #FFFFFF">#FFFFFF</font> => <font style="
color: #FFFFFF">#FFFFFF</font>
highlight.comment => <font style="color: #FF8000">#FF8000</font> => <font style=
"color: #FF8000">#FF8000</font>
highlight.default => <font style="color: #0000BB">#0000BB</font> => <font style=
"color: #0000BB">#0000BB</font>
highlight.html => <font style="color: #000000">#000000</font> => <font style="
color: #000000">#000000</font>
highlight.keyword => <font style="color: #007700">#007700</font> => <font style=
"color: #007700">#007700</font>
highlight.string => <font style="color: #DD0000">#DD0000</font> => <font style="
color: #DD0000">#DD0000</font>
html_errors => Off => Off
ignore_repeated_errors => Off => Off
ignore_repeated_source => Off => Off
ignore_user_abort => Off => Off
implicit_flush => On => On
include_path => .:/usr/local/lib/php => .:/usr/local/lib/php
log_errors => Off => Off
log_errors_max_len => 1024 => 1024
magic_quotes_gpc => On => On
magic_quotes_runtime => Off => Off
magic_quotes_sybase => Off => Off
mail.force_extra_parameters => no value => no value
max_execution_time => 0 => 0
max_input_nesting_level => 64 => 64
max_input_time => -1 => -1
memory_limit => 128M => 128M
open_basedir => no value => no value
output_buffering => 0 => 0
output_handler => no value => no value
post_max_size => 8M => 8M
precision => 14 => 14
realpath_cache_size => 16K => 16K
realpath_cache_ttl => 120 => 120
register_argc_argv => On => On
register_globals => Off => Off
register_long_arrays => On => On
report_memleaks => On => On
report_zend_debug => Off => Off
safe_mode => Off => Off
safe_mode_exec_dir => /usr/local/php/bin => /usr/local/php/bin
safe_mode_gid => Off => Off
safe_mode_include_dir => no value => no value
sendmail_from => no value => no value
sendmail_path => /usr/sbin/sendmail -t -i => /usr/sbin/sendmail -t -i
serialize_precision => 100 => 100
short_open_tag => On => On
SMTP => localhost => localhost
smtp_port => 25 => 25
sql.safe_mode => Off => Off
track_errors => Off => Off
unserialize_callback_func => no value => no value
upload_max_filesize => 2M => 2M
upload_tmp_dir => no value => no value
user_dir => no value => no value
variables_order => EGPCS => EGPCS
xmlrpc_error_number => 0 => 0
xmlrpc_errors => Off => Off
y2k_compliance => On => On
zend.ze1_compatibility_mode => Off => Off
ctype
ctype functions => enabled
curl
cURL support => enabled
cURL Information => libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
date
date/time support => enabled
"Olson" Timezone Database Version => 2008.2
Timezone Database => internal
Default timezone => Asia/Tokyo
Directive => Local Value => Master Value
date.default_latitude => 31.7667 => 31.7667
date.default_longitude => 35.2333 => 35.2333
date.sunrise_zenith => 90.583333 => 90.583333
date.sunset_zenith => 90.583333 => 90.583333
date.timezone => no value => no value
dom
DOM/XML => enabled
DOM/XML API Version => 20031129
libxml Version => 2.6.26
HTML Support => enabled
XPath Support => enabled
XPointer Support => enabled
Schema Support => enabled
RelaxNG Support => enabled
filter
Input Validation and Filtering => enabled
Revision => $Revision: 1.52.2.42 $
Directive => Local Value => Master Value
filter.default => unsafe_raw => unsafe_raw
filter.default_flags => no value => no value
ftp
FTP support => enabled
gd
GD Support => enabled GD Version => bundled (2.0.34 compatible) GIF Read Support => enabled GIF Create Support => enabled JPG Support => enabled PNG Support => enabled
WBMP Support => enabled
XBM Support => enabled
hash
hash support => enabled
Hashing Engines => md2 md4 md5 sha1 sha256 sha384 sha512 ripemd128 ripemd160
ripemd256 ripemd320 whirlpool tiger128,3 tiger160,3 tiger192,3 tiger128,4 tiger1
60,4 tiger192,4 snefru gost adler32 crc32 crc32b haval128,3 haval160,3 haval192,
3 haval224,3 haval256,3 haval128,4 haval160,4 haval192,4 haval224,4 haval256,4
haval128,5 haval160,5 haval192,5 haval224,5 haval256,5
iconv
iconv support => enabled
iconv implementation => glibc
iconv library version => 2.5
Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
json
json support => enabled
json version => 1.2.1
libxml
libXML support => active
libXML Version => 2.6.26
libXML streams => enabled
mbstring
Multibyte Support => enabled
Multibyte string engine => libmbfl
Multibyte (japanese) regex support => enabled
Multibyte regex (oniguruma) version => 4.4.4
Multibyte regex (oniguruma) backtrack check => On
mbstring extension makes use of "streamable kanji code filter and converter",
which is distributed under the GNU Lesser General Public License version 2.1.
Directive => Local Value => Master Value
mbstring.detect_order => no value => no value
mbstring.encoding_translation => Off => Off
mbstring.func_overload => 0 => 0
mbstring.http_input => pass => pass
mbstring.http_output => pass => pass
mbstring.internal_encoding => ISO-8859-1 => no value
mbstring.language => neutral => neutral
mbstring.strict_detection => Off => Off
mbstring.substitute_character => no value => no value
mysqli
MysqlI Support => enabled
Client API library version => 5.0.51a
Client API header version => 5.0.51a
MYSQLI_SOCKET => /var/lib/mysql/mysql.sock
Directive => Local Value => Master Value
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.reconnect => Off => Off
pcre
PCRE (Perl Compatible Regular Expressions) Support => enabled
PCRE Library Version => 7.6 2008-01-28
Directive => Local Value => Master Value
pcre.backtrack_limit => 100000 => 100000
pcre.recursion_limit => 100000 => 100000
PDO
PDO support => enabled
PDO drivers => sqlite2, sqlite
pdo_sqlite
PDO Driver for SQLite 3.x => enabled
PECL Module version => (bundled) 1.0.1 $Id: pdo_sqlite.c,v 1.10.2.6.2.3 2007/12/
31 07:20:10 sebastian Exp $
SQLite Library => 3.3.7
posix
Revision => $Revision: 1.70.2.3.2.18 $
Reflection
Reflection => enabled
Version => $Id: php_reflection.c,v 1.164.2.33.2.50 2008/03/13 15:56:21 iliaa Exp
$
session
Session Support => enabled
Registered save handlers => files user sqlite
Registered serializer handlers => php php_binary
Directive => Local Value => Master Value
session.auto_start => Off => Off
session.bug_compat_42 => On => On
session.bug_compat_warn => On => On
session.cache_expire => 180 => 180
session.cache_limiter => nocache => nocache
session.cookie_domain => no value => no value
session.cookie_httponly => Off => Off
session.cookie_lifetime => 0 => 0
session.cookie_path => / => /
session.cookie_secure => Off => Off
session.entropy_file => no value => no value
session.entropy_length => 0 => 0
session.gc_divisor => 100 => 100
session.gc_maxlifetime => 1440 => 1440
session.gc_probability => 1 => 1
session.hash_bits_per_character => 4 => 4
session.hash_function => 0 => 0
session.name => PHPSESSID => PHPSESSID
session.referer_check => no value => no value
session.save_handler => files => files
session.save_path => no value => no value
session.serialize_handler => php => php
session.use_cookies => On => On
session.use_only_cookies => Off => Off
session.use_trans_sid => 0 => 0
SimpleXML
Simplexml support => enabled
Revision => $Revision: 1.151.2.22.2.39 $
Schema support => enabled
SPL
SPL support => enabled
Interfaces => Countable, OuterIterator, RecursiveIterator, SeekableIterator,
SplObserver, SplSubject
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException,
BadMethodCallException, CachingIterator, DirectoryIterator, DomainException,
EmptyIterator, FilterIterator, InfiniteIterator, InvalidArgumentException,
IteratorIterator, LengthException, LimitIterator, LogicException,
NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException,
ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator,
RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator,
RecursiveRegexIterator, RegexIterator, RuntimeException, SimpleXMLIterator,
SplFileInfo, SplFileObject, SplObjectStorage, SplTempFileObject,
UnderflowException, UnexpectedValueException
SQLite
SQLite support => enabled
PECL Module version => 2.0-dev $Id: sqlite.c,v 1.166.2.13.2.10 2007/12/31 07:20:
11 sebastian Exp $
SQLite Library => 2.8.17
SQLite Encoding => iso8859
Directive => Local Value => Master Value
sqlite.assoc_case => 0 => 0
standard
Regex Library => Bundled library enabled
Dynamic Library Support => enabled
Path to sendmail => /usr/sbin/sendmail -t -i
Directive => Local Value => Master Value
assert.active => 1 => 1
assert.bail => 0 => 0
assert.callback => no value => no value
assert.quiet_eval => 0 => 0
assert.warning => 1 => 1
auto_detect_line_endings => 0 => 0
default_socket_timeout => 60 => 60
safe_mode_allowed_env_vars => PHP_ => PHP_
safe_mode_protected_env_vars => LD_LIBRARY_PATH => LD_LIBRARY_PATH
url_rewriter.tags => a=href,area=href,frame=src,form=,fieldset= => a=href,area=
href,frame=src,form=,fieldset=
user_agent => no value => no value
tokenizer
Tokenizer Support => enabled
xml
XML Support => active
XML Namespace Support => active
libxml2 Version => 2.6.26
xmlreader
XMLReader => enabled
xmlwriter
XMLWriter => enabled
zlib
ZLib Support => enabled
Stream Wrapper support => compress.zlib://
Stream Filter support => zlib.inflate, zlib.deflate
Compiled Version => 1.2.3
Linked Version => 1.2.3
Directive => Local Value => Master Value
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value
Additional Modules
Module Name
Environment
Variable => Value
HOSTNAME => ujpdev1
TERM => vt100
SHELL => /bin/bash
HISTSIZE => 1000
SSH_CLIENT => 192.168.200.123 62350 22
OLDPWD => /root
SSH_TTY => /dev/pts/0
USER => root
LS_COLORS => no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;3
3;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:
*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;
31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;3
1:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=0
1;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
MAIL => /var/spool/mail/root
PATH => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/
sbin:/bin:/usr/sbin:/usr/bin:/root/bin
INPUTRC => /etc/inputrc
PWD => /InstallBin/php-5.2.6
LANG => ja_JP.UTF-8
SSH_ASKPASS => /usr/libexec/openssh/gnome-ssh-askpass
SHLVL => 1
HOME => /root
LOGNAME => root
SSH_CONNECTION => 192.168.200.123 62350 192.168.25.34 22
LESSOPEN => |/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES => 1
_ => /usr/local/bin/php
PHP Variables
Variable => Value
_SERVER["HOSTNAME"] => ujpdev1
_SERVER["TERM"] => vt100
_SERVER["SHELL"] => /bin/bash
_SERVER["HISTSIZE"] => 1000
_SERVER["SSH_CLIENT"] => 192.168.200.123 62350 22
_SERVER["OLDPWD"] => /root
_SERVER["SSH_TTY"] => /dev/pts/0
_SERVER["USER"] => root
_SERVER["LS_COLORS"] => no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33
;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.
com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31
:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:
*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;
35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
_SERVER["MAIL"] => /var/spool/mail/root
_SERVER["PATH"] => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/
local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
_SERVER["INPUTRC"] => /etc/inputrc
_SERVER["PWD"] => /InstallBin/php-5.2.6
_SERVER["LANG"] => ja_JP.UTF-8
_SERVER["SSH_ASKPASS"] => /usr/libexec/openssh/gnome-ssh-askpass
_SERVER["SHLVL"] => 1
_SERVER["HOME"] => /root
_SERVER["LOGNAME"] => root
_SERVER["SSH_CONNECTION"] => 192.168.200.123 62350 192.168.25.34 22
_SERVER["LESSOPEN"] => |/usr/bin/lesspipe.sh %s
_SERVER["G_BROKEN_FILENAMES"] => 1
_SERVER["_"] => /usr/local/bin/php
_SERVER["PHP_SELF"] => _SERVER["SCRIPT_NAME"] => _SERVER["SCRIPT_FILENAME"] => _SE
RVER["PATH_TRANSLATED"] => _SERVER["DOCUMENT_ROOT"] => _SERVER["REQUEST_TIME"] =>
1212459509
_SERVER["argv"] => Array
(
)
_SERVER["argc"] => 0
_ENV["HOSTNAME"] => ujpdev1
_ENV["TERM"] => vt100
_ENV["SHELL"] => /bin/bash
_ENV["HISTSIZE"] => 1000
_ENV["SSH_CLIENT"] => 192.168.200.123 62350 22
_ENV["OLDPWD"] => /root
_ENV["SSH_TTY"] => /dev/pts/0
_ENV["USER"] => root
_ENV["LS_COLORS"] => no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01
:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.
com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31
:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:
*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;
35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
_ENV["MAIL"] => /var/spool/mail/root
_ENV["PATH"] => /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/
bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
_ENV["INPUTRC"] => /etc/inputrc
_ENV["PWD"] => /InstallBin/php-5.2.6
_ENV["LANG"] => ja_JP.UTF-8
_ENV["SSH_ASKPASS"] => /usr/libexec/openssh/gnome-ssh-askpass
_ENV["SHLVL"] => 1
_ENV["HOME"] => /root
_ENV["LOGNAME"] => root
_ENV["SSH_CONNECTION"] => 192.168.200.123 62350 192.168.25.34 22
_ENV["LESSOPEN"] => |/usr/bin/lesspipe.sh %s
_ENV["G_BROKEN_FILENAMES"] => 1
_ENV["_"] => /usr/local/bin/php
PHP License
This program is free software; you can redistribute it and/or modify
it under the terms of the PHP License as published by the PHP Group
and included in the distribution in the file: LICENSE
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
If you did not receive a copy of the PHP license, or have any
questions about PHP licensing, please contact license@php.net.
[root@ujpdev1 php-5.2.6]#
|
- 設定したモジュールは有効になっている事が確認できた.
6.Apacheとの連携の確認
- これまでの手順で,インストールと,モジュールの確認まで完了しているので,Apache2との連携について確認する.
- Apache2と連携する為のライブラリが作成されているか,確認する.
[root@ujpdev1 php-5.2.6]# ls -la /usr/local/apache2/modules/libphp5.so -rwxr-xr-x 1 root root 20687791 Jun 3 10:26 /usr/local/apache2/modules/libphp5.so [root@ujpdev1 php-5.2.6]#
|
- 次に,httpd.confファイルの中身を確認する.
- まずは,LoadModule句でlibphp5.soが記述されているか確認する.
- 正しくインストールされていれば,自動的に追加されているはず.
LoadModule句
LoadModule userdir_module modules/mod_userdir.so LoadModule alias_module modules/mod_alias.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule php5_module modules/libphp5.so
<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
#
|
- 追加されている事が確認できた.
- 次に,デフォルトで表示されるインデックスページへファイル名の登録設定を行う.
DirectoryIndex
# # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # <IfModule dir_module> DirectoryIndex index.php index.html </IfModule>
# # The following lines prevent .htaccess and .htpasswd files from being
|
- これで,index.htmlより先にindex.phpファイルが呼び出される設定となった.
- 次に,拡張子とそのファイルタイプをAddTypeで設定する.
AddType
# #AddType text/html .shtml #AddOutputFilter INCLUDES .shtml
#PHP AddType application/x-httpd-php .php .phtml AddType application/x-httpd-php-source .phps </IfModule>
# # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type. The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic
|
- これでApacheとの連携を試してみる為に,phpinfoを表示させるプログラムを稼働させてみる.
- まずは,DocumentRootを確認する.
[root@ujpdev1 php-5.2.6]# grep DocumentRoot /usr/local/apache2/conf/httpd.conf
# DocumentRoot: The directory out of which you will serve your
DocumentRoot "/usr/local/apache2/htdocs"
# This should be changed to whatever you set DocumentRoot to.
# access content that does not live under the DocumentRoot.
[root@ujpdev1 php-5.2.6]#
|
- DocumentRoot配下に,phpinfo()関数を実行する為のプログラムを設置する.
[root@ujpdev1 php-5.2.6]# echo "<?phpinfo();?>" > /usr/local/apache2/htdocs/phpinstalltest.php
[root@ujpdev1 php-5.2.6]# cat /usr/local/apache2/htdocs/phpinstalltest.php <?phpinfo();?>
[root@ujpdev1 php-5.2.6]#
|
- なお,このときにphpinfo.php等の安易に推測できるファイル名としない.
- httpd.confに,ServerNameが設定されているか確認する.
[root@ujpdev1 php-5.2.6]# grep ServerName /usr/local/apache2/conf/httpd.conf # ServerName gives the name and port that the server uses to identify itself. #ServerName www.example.com:80 ServerName ap1.ujp.jp:80
[root@ujpdev1 php-5.2.6]#
|
[root@ujpdev1 php-5.2.6]# /usr/local/apache2/bin/apachectl start [root@ujpdev1 php-5.2.6]#
|
- この様に表示されたので,ApacheとPHPが連携して動作している事が確認できる.
7.PHP.INIの作成
- PHPの設定ファイルを追加する.
- まずは,テンプレートファイルを確認する.
[root@ujpdev1 php-5.2.6]# ls -la php.ini-dist
-rw-r--r-- 1 1002 1002 45030 Feb 11 09:01 php.ini-dist
[root@ujpdev1 php-5.2.6]#
|
- php.iniファイルがどこに保存される様に設定されているか,確認する.
[root@ujpdev1 php-5.2.6]# php -i|grep php.ini
Configuration File (php.ini) Path => /usr/local/lib [root@ujpdev1 php-5.2.6]#
|
[root@ujpdev1 php-5.2.6]# ls -la /usr/local/lib/php.ini
ls: /usr/local/lib/php.ini: No such file or directory
[root@ujpdev1 php-5.2.6]#
|
- ファイルが無いので,テンプレートを複写して利用する.
[root@ujpdev1 php-5.2.6]# cp php.ini-dist /usr/local/lib/php.ini
[root@ujpdev1 php-5.2.6]#
|
- また,OSインストール時等に,/etc/php.iniファイルが作成されている場合がある.
[root@ujpdev1 php-5.2.6]# ls -la /etc/php.ini
-rw-r--r-- 1 root root 45078 Sep 20 2007 /etc/php.ini
[root@ujpdev1 php-5.2.6]# m
|
[root@ujpdev1 php-5.2.6]# mv /etc/php.ini /etc/php.ini.org
[root@ujpdev1 php-5.2.6]#
|
8.セキュリティ向上の為のPHPのバナー表示のオフ
- PHPのバナーを表示しない様に設定する.
- バナーが表示されるとPHPのバージョンが外部からのアクセスでわかってしまうので,特定のバージョンのセキュリティホールが発見されている場合はアタックを受けやすいと考えられる.
- expose_phpをoffにする事で,PHPのバージョン番号を表示しない様になる.
変更前
|
; Decides whether PHP may expose the fact that it is installed on the server ; (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
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
|
変更後 |
; Decides whether PHP may expose the fact that it is installed on the server ; (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
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
|
[root@ujpdev1 php-5.2.6]# curl -I http://localhost
HTTP/1.1 200 OK
Date: Tue, 03 Jun 2008 03:31:53 GMT
Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8b DAV/2 PHP/5.2.6
Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT
ETag: "34889d-2c-3e9564c23b600"
Accept-Ranges: bytes
Content-Length: 44
Content-Type: text/html
[root@ujpdev1 php-5.2.6]#
|
- このリクエストでは,HTTPのヘッダ情報のみを表示している.
- PHPのバージョン番号が表示されている.
- 先ほど編集したPHP.INIが反映される様に,Apacheを再起動する.
[root@ujpdev1 php-5.2.6]# /usr/local/apache2/bin/apachectl stop
[root@ujpdev1 php-5.2.6]# /usr/local/apache2/bin/apachectl start
[root@ujpdev1 php-5.2.6]#
|
[root@ujpdev1 php-5.2.6]# curl -I http://localhost
HTTP/1.1 200 OK
Date: Tue, 03 Jun 2008 03:32:37 GMT
Server: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8b DAV/2 Last-Modified: Sat, 20 Nov 2004 20:16:24 GMT ETag: "34889d-2c-3e9564c23b600" Accept-Ranges: bytes Content-Length: 44 Content-Type: text/html
[root@ujpdev1 php-5.2.6]#
|
- PHPのバージョンが表示されなくなった事が確認できた.
9.セキュリティ向上の為のmagic_quotes_gpcの設定
- magic_quotes_gpcは,セキュリティ上好ましくないので,offにする.
- デフォルトでは,以下の様にonとなっている.
変更前
|
; Magic quotes ;
; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = On
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
|
変更後 |
; Magic quotes ;
; Magic quotes for incoming GET/POST/Cookie data. ;magic_quotes_gpc = On magic_quotes_gpc = Off
; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc.
magic_quotes_runtime = Off
|
- magic_quotes_gpcのGPCは,GET/POST/Cookieの略.
- 概略
- GPCからのデータ受け渡しの際には,エスケープ処理が行われる.
- 以下の問題は,PHP5の実装で.
- 問題1 論理的エラーを生む可能性
- GCP以外の方法で受け渡されたデータは,エスケープ処理が行われていない.
- データベース,他システム連携,$_ENVで取得する環境変数等
- 問題は,エスケープされているものとされないものが混在する複雑性.
- 混在する事によって,二重エスケープや漏れが発生する.
- 問題2 実装上の問題
- 文字エンコーディングが,latin 1を前提としてエスケープ処理をしている
- MySQLのエスケープを念頭において実装されている.
- ということで,offにしておく.
10.日本語設定(mbstring)
- mbstring(マルチバイト)の設定について説明する.
- なお,今回はUTF8の利用を前提とする.
- まずは,デフォルトの文字コード.
変更前
|
; ; PHP's built-in default is text/html default_mimetype = "text/html" ;default_charset = "iso-8859-1"
; Always populate the $HTTP_RAW_POST_DATA variable.
;always_populate_raw_post_data = On
|
変更後 |
; ; PHP's built-in default is text/html default_mimetype = "text/html" ;default_charset = "iso-8859-1" default_charset = "UTF-8"
; Always populate the $HTTP_RAW_POST_DATA variable.
;always_populate_raw_post_data = On
|
- PHPが生成した出力結果をHTTPヘッダで指定するときに利用.
- デフォルトは指定されていない.
- 文字コードを不確かな状態にしておくとエンコード/デコードの際にXSS(クロスサイトスクリプティングの)の脆弱性を招く可能性が高くなる.
- 次に,languageを設定する.
変更前
|
[mbstring] ; language for internal character representation. ;mbstring.language = Japanese
; internal/script encoding.
|
変更後 |
[mbstring] ; language for internal character representation. ;mbstring.language = Japanese mbstring.language = Japanese
; internal/script encoding.
|
- これは明示的に日本語だと認識させる.
- 次に,PHPのスクリプト(プログラム)を保存するときの文字コードについて指定する.
変更前
|
; internal/script encoding. ; Some encoding cannot work as internal encoding. ; (e.g. SJIS, BIG5, ISO-2022-*) ;mbstring.internal_encoding = EUC-JP
|
変更後 |
internal/script encoding. ; Some encoding cannot work as internal encoding. ; (e.g. SJIS, BIG5, ISO-2022-*) ;mbstring.internal_encoding = EUC-JP mbstring.internal_encoding = UTF-8
|
- プログラムファイルの文字コードは,UTF-8として設定するため,internal_encodingをUTF-として設定する.
変更前
|
; http input encoding. ;mbstring.http_input = auto
|
変更後 |
; http input encoding. ;mbstring.http_input = auto mbstring.http_input = pass
|
- クライアント側のから入力されたデータは,設定は,変換せずに通す設定とする.
- 次は,出力の設定.
変更前
|
; http output encoding. mb_output_handler must be ; registered as output buffer to function ;mbstring.http_output = SJIS
|
変更後 |
; http output encoding. mb_output_handler must be ; registered as output buffer to function ;mbstring.http_output = SJIS mbstring.http_output = pass
|
- これもプログラム側での設定を有効とする為に,passとする.
- 次は,自動的にエンコードするかどうかの設定.
- 透過的に変換を行う場合はOnにする.
変更前
|
; 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
|
変更後 |
; 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 = Off
|
- ここでは自動的に変更しない様にする為に,offとして明示的に設定する.
- 次は,自動エンコーディングをするときの,文字コードのい評価順.
- 指定する場合は,detect_order = UTF-8, SJIS, EUC-JP等とする.
変更前
|
; automatic encoding detection order. ; auto means ;mbstring.detect_order = auto
|
変更後 |
; automatic encoding detection order. ; auto means ;mbstring.detect_order = auto
|
- 自動エンコードをoffにしているので,設定していない.
- 次は,substituteキャラクターの設定.
- substituteとは,「代替え」の意味で,無効な文字があった場合の設定となる.
変更前
|
; substitute_character used when character cannot be converted ; one from another ;mbstring.substitute_character = none;
|
変更後 |
; substitute_character used when character cannot be converted ; one from another ;mbstring.substitute_character = none; mbstring.substitute_character = none;
|
- 無効な文字なので,出力しない為に,noneを明示的に設定する.
11.MySQLiインタフェイスを使ってMySQLに接続確認
[root@ujpdev1 php-5.2.6]# cat sqli.php
<?php
/* create a connection object which is not connected */
$mysqli = mysqli_init();
/* set connection options */
$mysqli->options(MYSQLI_INIT_COMMAND, "SET AUTOCOMMIT=0");
$mysqli->options(MYSQLI_OPT_CONNECT_TIMEOUT, 5);
/* connect to server */
$mysqli->real_connect('server', 'user', 'pass', 'databasename');
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s¥n", mysqli_connect_error());
exit();
}
printf ("Connection: %s¥n.", $mysqli->host_info);
$mysqli->close();
?>
[root@ujpdev1 php-5.2.6]#
|
正しく接続できた場合
|
[root@ujpdev1 php-5.2.6]# php sqli.php Connection: Localhost via UNIX socket [root@ujpdev1 php-5.2.6]#
|
認証エラーがでた場合 |
[root@ujpdev1 php-5.2.6]# php sqli.php
Warning: mysqli::real_connect(): (28000/1045): Access denied for user 'root'@' localhost' (using password: YES) in /InstallBin/php-5.2.6/sqli.php on line 11 Connect failed: Access denied for user 'root'@'localhost' (using password: YES) [root@ujpdev1 php-5.2.6]#
|
- どちらにしてもデータベースアクセス用のライブラリが呼び出され,接続を試みている事がわかる.
|
|