{"id":3424,"date":"2021-07-30T20:26:31","date_gmt":"2021-07-30T11:26:31","guid":{"rendered":"https:\/\/taitan916.info\/blog\/?p=3424"},"modified":"2021-07-30T20:41:16","modified_gmt":"2021-07-30T11:41:16","slug":"post-3424","status":"publish","type":"post","link":"https:\/\/taitan916.info\/blog\/archives\/3424","title":{"rendered":"PHP7.4\u3067APCu\u3068OPcache\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><a href=\"https:\/\/taitan916.info\/blog\/archives\/3418\" target=\"_blank\" rel=\"noopener\">\u5148\u65e5\u672c\u30d6\u30ed\u30b0\u306e\u30b5\u30fc\u30d0\u3092CentOS6\u7cfb\u304b\u30897\u7cfb\u306b\u79fb\u884c<\/a>\u3057\u3001\u305d\u306e\u969b\u306bMySQL\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3082\u4e0a\u304c\u3063\u305f\u70ba\u3001<a href=\"https:\/\/yakst.com\/ja\/posts\/4612\" target=\"_blank\" rel=\"noopener\">\u30af\u30a8\u30ea\u30ad\u30e3\u30c3\u30b7\u30e5\u304c\u4f7f\u3048\u306a\u304f\u306a\u3063\u305f<\/a>\u3002\u305d\u306e\u5206\u306e\u9ad8\u901f\u5316\u3084\u30b5\u30fc\u30d0\u8ca0\u8377\u8efd\u6e1b\u3092\u4ed6\u306e\u90e8\u5206\u3067\u88dc\u304a\u3046\u3068\u601d\u3044\u8abf\u3079\u3066\u307f\u305f\u3068\u3053\u308d\u3001PHP7\u7cfb\u3067\u306fAPCu\u3068OPcache\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308b\u3089\u3057\u3044\u3002\u4ee5\u4e0b\u306b\u5c0e\u5165\u65b9\u6cd5\u3092\u30e1\u30e2\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h2>\n<p>SSH\u63a5\u7d9a\u3057\u3001\u4ee5\u4e0b\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">#APCu\u3068OPcache\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\r\nyum -y install --enablerepo=remi,remi-php74 php-opcache php-pecl-apcu\r\n\r\n#\u6b63\u5e38\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\r\nrpm -qa | grep php\r\n\r\n#\u4ee5\u4e0b\u304c\u30ea\u30b9\u30c8\u5185\u306b\u3042\u308c\u3070OK\r\nphp-opcache-7.4.19-1.el7.remi.x86_64\r\nphp-pecl-apcu-5.1.20-1.el7.remi.7.4.x86_64<\/pre>\n<p>&nbsp;<\/p>\n<h2>OPcache\u306e\u8a2d\u5b9a<\/h2>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">#\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\r\nvi \/etc\/php.d\/10-opcache.ini\r\n\r\n#\u5909\u66f4\u524d\r\n;opcache.memory_consumption=128\r\n\r\n#\u5909\u66f4\u5f8c\r\nopcache.memory_consumption=64<\/pre>\n<p>opcache.memory_consumption\u306fOPcache\u306b<a href=\"https:\/\/www.php.net\/manual\/ja\/opcache.configuration.php#ini.opcache.memory-consumption\" target=\"_blank\" rel=\"noopener\">\u4f7f\u7528\u3055\u308c\u308b\u30e1\u30e2\u30ea\u306e\u30b5\u30a4\u30ba<\/a>(MB\u5358\u4f4d)\u306b\u306a\u308b\u3002\u5f53\u65b9\u306e\u74b0\u5883\u304c\u30e1\u30e2\u30ea1GB\u306e\u30b5\u30fc\u30d0\u306e\u70ba\u3001128MB\u3060\u3068\u82e5\u5e72\u4f7f\u3044\u3059\u304e\u306a\u6c17\u304c\u3057\u305f\u306e\u306764MB\u306b\u3057\u305f\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/h2>\n<p>\u5404\u7a2e\u8a2d\u5b9a\u306f\u4ee5\u4e0b\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u53c2\u8003\u306b\u3059\u308b\u3002<\/p>\n<p><strong>APCu<\/strong><\/p>\n<p><a href=\"https:\/\/www.php.net\/manual\/ja\/apcu.configuration.php\" target=\"_blank\" rel=\"noopener\">https:\/\/www.php.net\/manual\/ja\/apcu.configuration.php<\/a><\/p>\n<p><strong>OPcache<\/strong><\/p>\n<p><a href=\"https:\/\/www.php.net\/manual\/ja\/opcache.configuration.php\" target=\"_blank\" rel=\"noopener\">https:\/\/www.php.net\/manual\/ja\/opcache.configuration.php<\/a><\/p>\n<p>\u5c1a\u3001APCu\u306f\u5927\u534a\u306e\u74b0\u5883\u3067\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u8a2d\u5b9a\u3067\u554f\u984c\u7121\u3044\u3068\u306e\u3053\u3068\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u72b6\u6cc1\u306e\u30c1\u30a7\u30c3\u30af<\/h2>\n<p>APCu \/ OPcache\u5171\u306b\u7ba1\u7406\u753b\u9762\u306e\u3088\u3046\u306a\u3082\u306e\u3092\u5c0e\u5165\u3059\u308c\u3070\u30d6\u30e9\u30a6\u30b6\u4e0a\u3067\u30ad\u30e3\u30c3\u30b7\u30e5\u72b6\u6cc1\u306e\u30c1\u30a7\u30c3\u30af\u3092\u884c\u3048\u308b\u3002\u4ee5\u4e0b\u304c\u5bfe\u5fdc\u65b9\u6cd5\u3002<\/p>\n<h3>APCu<\/h3>\n<p>\u4ee5\u4e0b\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5f8c\u3001\u5c55\u958b\u3057\u9069\u5f53\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/krakjoe\/apcu\/archive\/master.zip\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/krakjoe\/apcu\/archive\/master.zip<\/a><\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u300chttps:\/\/\u30c9\u30e1\u30a4\u30f3\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\/apc.php\u300d\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3002\u5c1a\u300139\u884c\u76ee\u8fba\u308a\u306e\u4ee5\u4e0b\u90e8\u5206\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067Basic\u8a8d\u8a3c\u304c\u304b\u304b\u308b\u6a21\u69d8\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">defaults(&#039;ADMIN_USERNAME&#039;,&#039;xxxxx&#039;); \t\t\t\/\/ Admin Username\r\ndefaults(&#039;ADMIN_PASSWORD&#039;,&#039;xxxxx&#039;);  \t\/\/ Admin Password - CHANGE THIS TO ENABLE!!!<\/pre>\n<p>\u305f\u3060\u3001\u65e2\u306bBasic\u8a8d\u8a3c\u3092\u304b\u3051\u3066\u3044\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u3066\u304a\u308a\u3001\u4e0a\u8a18\u5909\u66f4\u3092\u884c\u3046\u3068\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u305f\u3002\u305d\u306e\u70ba\u3001\u65e2\u306bBasic\u8a8d\u8a3c\u3092\u304b\u3051\u3066\u3044\u308b\u5834\u5408\u306f\u4e0a\u8a18\u5909\u66f4\u3092\u884c\u308f\u306a\u3044\u3053\u3068\u3002<\/p>\n<h3>OPcache<\/h3>\n<p>\u4ee5\u4e0b\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u5f8c\u3001\u5c55\u958b\u3057\u9069\u5f53\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u3002<\/p>\n<p><a href=\"https:\/\/gist.github.com\/ck-on\/4959032\" target=\"_blank\" rel=\"noopener\">https:\/\/gist.github.com\/ck-on\/4959032<\/a><\/p>\n<p>\u30d6\u30e9\u30a6\u30b6\u304b\u3089\u300chttps:\/\/\u30c9\u30e1\u30a4\u30f3\/\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\/ocp.php\u300d\u3067\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u6240\u611f<\/h2>\n<p>\u7ba1\u7406\u753b\u9762\u3092\u898b\u3066\u307f\u308b\u3068OPcache\u306f\u554f\u984c\u306a\u304f\u52d5\u3044\u3066\u3044\u308b\u3088\u3046\u3060\u3051\u3069\u3001APCu\u306e\u65b9\u306f\u5168\u304f\u52d5\u3044\u3066\u3044\u306a\u3044\u3088\u3046\u306b\u898b\u53d7\u3051\u3089\u308c\u305f\u3002\u8abf\u3079\u3066\u307f\u308b\u3068<a href=\"https:\/\/retu27.com\/apc_apcu_cache.html#APCAPCU-2\" target=\"_blank\" rel=\"noopener\">APCu\u306f\u5c0e\u5165\u3057\u305f\u3060\u3051\u3067\u306f\u610f\u5473\u304c\u7121\u304f<\/a>\u3001\u300cAPCu\u3092\u4f7f\u3044\u307e\u3059\u3088\u300d\u3068\u3044\u3046\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u304b\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3089\u3057\u3044\u3002<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"\">&lt;?php\r\nini_set( &#039;display_errors&#039;, 1 );\r\n\r\n$key = &#039;hoge&#039;;\r\n\r\n$data = [\r\n    &#039;test&#039;,\r\n    &#039;hoge&#039; =&gt; [\r\n        &#039;fuga&#039;,\r\n        &#039;foo&#039; =&gt; &#039;bar&#039;\r\n    ]\r\n];\r\n\r\napcu_store($key, $data);\r\n\r\nprint_r(apcu_cache_info());\r\n\r\napcu_fetch($key);<\/pre>\n<p>key \/ value\u5f62\u5f0f\u3067\u30e1\u30e2\u30ea\u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3059\u308bmemcached\u306e\u3088\u3046\u306a\u3082\u306e\u3063\u307d\u3044\u3002<\/p>\n<p>&nbsp;<\/p>\n<h2>\u53c2\u8003\u30b5\u30a4\u30c8<\/h2>\n<p><a href=\"https:\/\/sys-guard.com\/post-13742\/\" target=\"_blank\" rel=\"noopener\">https:\/\/sys-guard.com\/post-13742\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u65e5\u672c\u30d6\u30ed\u30b0\u306e\u30b5\u30fc\u30d0\u3092CentOS6\u7cfb\u304b\u30897\u7cfb\u306b\u79fb\u884c\u3057\u3001\u305d\u306e\u969b\u306bMySQL\u306e\u30d0\u30fc ... <\/p>\n","protected":false},"author":1,"featured_media":1085,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2],"tags":[],"class_list":["post-3424","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/comments?post=3424"}],"version-history":[{"count":0,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/posts\/3424\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media\/1085"}],"wp:attachment":[{"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/media?parent=3424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/categories?post=3424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/taitan916.info\/blog\/wp-json\/wp\/v2\/tags?post=3424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}