忍者ブログ

カウンター

プロモーション

カレンダー

04 2024/05 06
S M T W T F S
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

AntinomyMy の実験室

   私のWEBアプリ実験室です!

ブログ内検索

楽天でお買い物

twitter

最新トラックバック

最新コメント

忍者アナライズ

ウェザーニュース

バーコード

本を買う

アクセス解析

Google+

[PR]

×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。


  • 2024/05/02 06:41

php7.2 で確認。php_opcache はZend OPcache 、つまりextension でなくzend_extension だった。

PHP の調べ物

OPcacheは、PHP7.2 のWindows ローカルでようやく使い出したので、
それ以前は知らない。

なぜ使おうかと思ったかと言うと、
OPcache はPHP7.1からかなり早くなったらしい(余談だけど)。

php.ini

exteinsion の記述になぜか
;extension=php_opcache
という注釈化された記述がない

おかしいな?

ext フォルダに
php_opcache.dll

があるんだけど

試しに
extension=php_opcache
と記述

動かない!!!

意味が分からないのでネットで調べると
zend_extension=

"xxx\php_opcache.dll"
が読み込まれる設定の記述が

試しにやってみる
zend_extension="ext\php_opcache.dll"

動かない・・・

うん?!
コマンドラインCli の方で実行すると、どうもext にext のフォルダがない様な趣旨のエラー

もともと、extension のフォルダの中身を、見ているみたい。
バッチファイル(.bat)によってコマンドとして、php.exe を-S として
呼び出す様にして使っているので、
extension_dir = "./ext"
としてあるので、ここを
zend_extension
の設定は見ている様だ。

なんかややこしいが


zend_extension="php_opcache.dll"
としたら
なんと動いた!

後はphp.ini に非常に多くの設定があるの

[opcache]
zend_extension= "php_opcache.dll"
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
opcache.enable_cli=1
; The OPcache shared memory storage size.
opcache.memory_consumption=128
; The amount of memory for interned strings in Mbytes.
opcache.interned_strings_buffer=8
; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 1000000 are allowed.
opcache.max_accelerated_files=10000
; The maximum percentage of "wasted" memory until a restart is scheduled.
opcache.max_wasted_percentage=5
; When this directive is enabled, the OPcache appends the current working
; directory to the script key, thus eliminating possible collisions between
; files with the same name (basename). Disabling the directive improves
; performance, but may break existing applications.
;opcache.use_cwd=1
; When disabled, you must reset the OPcache manually or restart the
; webserver for changes to the filesystem to take effect.
;opcache.validate_timestamps=1
; How often (in seconds) to check file timestamps for changes to the shared
; memory storage allocation. ("1" means validate once per second, but only
; once per request. "0" means always validate)
opcache.revalidate_freq=2
; Enables or disables file search in include_path optimization
;opcache.revalidate_path=0
; If disabled, all PHPDoc comments are dropped from the code to reduce the
; size of the optimized code.
;opcache.save_comments=1
; Allow file existence override (file_exists, etc.) performance feature.
;opcache.enable_file_override=0
; A bitmask, where each bit enables or disables the appropriate OPcache
; passes
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
; The location of the OPcache blacklist file (wildcards allowed).
; Each OPcache blacklist file is a text file that holds the names of files
; that should not be accelerated. The file format is to add each filename
; to a new line. The filename may be a full path or just a file prefix
; (i.e., /var/www/x  blacklists all the files and directories in /var/www
; that start with 'x'). Line starting with a ; are ignored (comments).
;opcache.blacklist_filename=
; Allows exclusion of large files from being cached. By default all files
; are cached.
;opcache.max_file_size=0
; Check the cache checksum each N requests.
; The default value of "0" means that the checks are disabled.
;opcache.consistency_checks=0
; How long to wait (in seconds) for a scheduled restart to begin if the cache
; is not being accessed.
;opcache.force_restart_timeout=180
; OPcache error_log file name. Empty string assumes "stderr".
;opcache.error_log=
; All OPcache errors go to the Web server log.
; By default, only fatal errors (level 0) or errors (level 1) are logged.
; You can also enable warnings (level 2), info messages (level 3) or
; debug messages (level 4).
;opcache.log_verbosity_level=1
; Preferred Shared Memory back-end. Leave empty and let the system decide.
;opcache.preferred_memory_model=
; Protect the shared memory from unexpected writing during script execution.
; Useful for internal debugging only.
;opcache.protect_memory=0
; Allows calling OPcache API functions only from PHP scripts which path is
; started from specified string. The default "" means no restriction
;opcache.restrict_api=
; Mapping base of shared memory segments (for Windows only). All the PHP
; processes have to map shared memory into the same address space. This
; directive allows to manually fix the "Unable to reattach to base address"
; errors.
;opcache.mmap_base=
; Enables and sets the second level cache directory.
; It should improve performance when SHM memory is full, at server restart or
; SHM reset. The default "" disables file based caching.
;opcache.file_cache=
; Enables or disables opcode caching in shared memory.
;opcache.file_cache_only=0
; Enables or disables checksum validation when script loaded from file cache.
;opcache.file_cache_consistency_checks=1
; Implies opcache.file_cache_only=1 for a certain process that failed to
; reattach to the shared memory (for Windows only). Explicitly enabled file
; cache is required.
;opcache.file_cache_fallback=1
; Enables or disables copying of PHP code (text segment) into HUGE PAGES.
; This should improve performance, but requires appropriate OS configuration.
;opcache.huge_code_pages=1
; Validate cached file permissions.
;opcache.validate_permission=0
; Prevent name collisions in chroot'ed environment.
;opcache.validate_root=0
こんな感じで設定したら

Zend OPcache

Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
Startup OK
Shared memory model win32
Cache hits 0
Cache misses 1
Used memory 18735736
Free memory 115481992
Wasted memory 0
Interned Strings Used memory 193336
Interned Strings Free memory 8195272
Cached scripts 1
Cached keys 1
Max keys 16229
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
DirectiveLocal ValueMaster Value
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.file_cache no value no value
opcache.file_cache_consistency_checks 1 1
opcache.file_cache_fallback 1 1
opcache.file_cache_only 0 0
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.inherited_hack On On
opcache.interned_strings_buffer 8 8
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 10000 10000
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.opt_debug_level 0 0
opcache.optimization_level 0x7FFFBFFF 0x7FFFBFFF
opcache.preferred_memory_model no value no value
opcache.protect_memory 0 0
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments 1 1
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_timestamps On On
こんな感じだった。

セオリー的な設定とかある様だが、
ネット上の検索や公式では
http://php.net/manual/ja/opcache.installation.php
以下


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

とりあえず、PHP7.2 に
なぜかPHP5x のバージョンのphp.ini になかったOPcache項目が
注釈で書かれているし、なかった項目や、なくなった項目とかも
多分ありそうなので、見直した方がいいかなと思う。

インクルード先の話は戻るが、
dell 本体の名前を、php_zend_opcache.dll
とか、そういうリネーム(普通しない)にするか、
それともインクルード先として読みに行くext フォルダの中に
子のフォルダを適当な区別できる名前(zend とかOutside)のフォルダの中に
入れてくれるか、どっちかをしないと、zend_extensionの分類で
インクルードしていることが分かり難い。

フルパスでない場合にはextension_dir を
zend_extension は見ているとか、
説明どこかにあるのか(単純に無い?)は知らないが、直感的にはわからない



悩んでたのでメモにしたら長くなったブログでした

お粗末<_ _>

拍手[0回]

PR


  • 2018/02/22 21:45

コメント一覧

  • お名前
  • Email

  • コメント

  • Vodafone絵文字 i-mode絵文字 Ezweb絵文字
  • パスワード
[PR]