takaya030の備忘録

PHP、Laravel、Docker などの話がメインです

XAMPP 5.5.19 インストール後の PHP の初期設定

XAMPP 5.5.19 インストールしたときの PHP の設定についての作業メモ。
http://localhost/xampp/ は表示できているものとして話を進めます。

composer のインストール

xampp\php に移動

D:\>cd D:\xampp\php

以下を実行して composer.phar を作成

D:\xampp\php>php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

以下の内容で composer.bat を作成

@ECHO OFF
php "%~dp0composer.phar" %*

動作確認

D:\xampp\php>composer --version
Composer version 1.0-dev (c58b7d917c65692eeb00c22b2fbaaa251cb390dc) 2015-01-05 16:31:16

PHPUnit のインストール

XAMPP に含まれている PHPUnit は古いので新しいものをインストールします。

元のファイルをリネームします。

D:\xampp\php>ren phpunit phpunit.old
D:\xampp\php>ren phpunit.bat phpunit.bat.old

以下の URL から phpunit.phar をダウンロード

phpunit.phar を xampp\php\ にコピー

以下の内容で phpunit.bat を作成

xampp\php\phpunit.bat

@ECHO OFF
php "%~dp0phpunit.phar" %*

動作確認

D:\xampp\php>phpunit --version
PHPUnit 4.4.1 by Sebastian Bergmann.

php.ini の変更

以下の diff の通りに xampp\php\php.ini を変更。
変更の内訳

  1. timezone を Asia/Tokyo に変更
  2. Zend Opcache を有効化
  3. SSL を有効化

xampp\php\php.ini.diff

--- php.ini.orig	2013-03-30 11:29:00 +0900
+++ php.ini	2015-01-12 16:02:08 +0900
@@ -1006,7 +1006,8 @@
 extension=php_mysqli.dll
 ;extension=php_oci8.dll      ; Use with Oracle 10gR2 Instant Client
 ;extension=php_oci8_11g.dll  ; Use with Oracle 11gR2 Instant Client
-;extension=php_openssl.dll
+zend_extension=php_opcache.dll
+extension=php_openssl.dll
 ;extension=php_pdo_firebird.dll
 extension=php_pdo_mysql.dll
 ;extension=php_pdo_oci.dll
@@ -1041,7 +1042,7 @@
 [Date]
 ; Defines the default timezone used by the date functions
 ; http://php.net/date.timezone
-date.timezone = Europe/Berlin
+date.timezone = Asia/Tokyo
 
 ; http://php.net/date.default-latitude
 ;date.default_latitude = 31.7667
@@ -2086,3 +2087,11 @@
 ;xdebug.remote_handler = "dbgp"
 ;xdebug.remote_host = "127.0.0.1"
 ;xdebug.trace_output_dir = "\xampp\tmp"
+
+; Zend Opcache
+opcache.memory_consumption=128
+opcache.interned_strings_buffer=8
+opcache.max_accelerated_files=4000
+opcache.revalidate_freq=60
+opcache.fast_shutdown=1
+opcache.enable_cli=1

動作確認

D:\xampp\php>php -i | grep -i timezone
"Olson" Timezone Database Version => 2014.9
Timezone Database => internal
Default timezone => Asia/Tokyo
date.timezone => Asia/Tokyo => Asia/Tokyo
D:\xampp\php>php -i | grep -i opcache
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
Zend OPcache
opcache.blacklist_filename => no value => no value
opcache.consistency_checks => 0 => 0
opcache.dups_fix => Off => Off
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.enable_file_override => Off => Off
opcache.error_log => no value => no value
opcache.fast_shutdown => 1 => 1
opcache.file_update_protection => 2 => 2
opcache.force_restart_timeout => 180 => 180
opcache.inherited_hack => On => On
opcache.interned_strings_buffer => 8 => 8
opcache.load_comments => 1 => 1
opcache.log_verbosity_level => 1 => 1
opcache.max_accelerated_files => 4000 => 4000
opcache.max_file_size => 0 => 0
opcache.max_wasted_percentage => 5 => 5
opcache.memory_consumption => 128 => 128
opcache.mmap_base => no value => no value
opcache.optimization_level => 0xFFFFFFFF => 0xFFFFFFFF
opcache.preferred_memory_model => no value => no value
opcache.protect_memory => 0 => 0
opcache.restrict_api => no value => no value
opcache.revalidate_freq => 60 => 60
opcache.revalidate_path => Off => Off
opcache.save_comments => 1 => 1
opcache.use_cwd => On => On
opcache.validate_timestamps => On => On
D:\xampp\php>php -i | grep -i ssl
Registered Stream Socket Transports => tcp, udp, ssl, sslv3, sslv2, tls
SSL => Yes
SSL Version => OpenSSL/1.0.1i
core SSL => supported
extended SSL => not supported
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.1i 6 Aug 2014
OpenSSL Header Version => OpenSSL 1.0.1i 6 Aug 2014
OpenSSL support => enabled

追記

  • 2015/01/24 SSL 有効化の設定を追加