{"id":379,"date":"2021-08-17T17:22:32","date_gmt":"2021-08-17T20:22:32","guid":{"rendered":"http:\/\/hackerzone.com.br\/blog\/?p=379"},"modified":"2022-08-13T00:08:46","modified_gmt":"2022-08-13T03:08:46","slug":"problemas-com-cache-no-php","status":"publish","type":"post","link":"http:\/\/hackerzone.com.br\/blog\/problemas-com-cache-no-php\/","title":{"rendered":"Problemas com cache no PHP"},"content":{"rendered":"<p>Tive alguns problemas relacionados ao <strong>Opcache<\/strong> e <strong>FastCGI\/PHP-FPM<\/strong>, para resolver este problema eu procurei algumas alternativas como atualizar o servi\u00e7o do <strong>PHP-FPM<\/strong>, por\u00e9m se torna um pouco invi\u00e1vel se toda vez precisar acessar o SSH, ent\u00e3o trouxe aqui uma solu\u00e7\u00e3o bem simples para atualizar o cache.<\/p>\n<p>Crie um arquivo no diret\u00f3rio raiz de seu projeto e acesse ele via HTTP normalmente, adicione o seguinte comando <strong>(opcache_reset())<\/strong> neste arquivo:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n&lt;?php\r\n$limpeza = opcache_reset();\r\n\r\nif($limpeza){\r\n    echo 'Ok! O cache foi limpo com sucesso.';\r\n}else{\r\n    echo 'Erro! A limpeza de cache esta desabilitada';\r\n}\r\n?&gt;\r\n<\/pre>\n<p>Refer\u00eancias:<br \/>\n<a href=\"https:\/\/imasters.com.br\/back-end\/como-limpar-o-opcache-do-php\">https:\/\/imasters.com.br\/back-end\/como-limpar-o-opcache-do-php<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tive alguns problemas relacionados ao Opcache e FastCGI\/PHP-FPM, para resolver este problema eu procurei algumas alternativas como atualizar o servi\u00e7o do PHP-FPM, por\u00e9m se torna um pouco invi\u00e1vel se toda vez precisar acessar o SSH, ent\u00e3o trouxe aqui uma solu\u00e7\u00e3o bem simples para atualizar o cache. Crie um arquivo no diret\u00f3rio raiz de seu projeto [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":456,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[165,41,2,12,162],"tags":[170,171,172,163],"class_list":["post-379","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","category-centos","category-linux","category-php","category-php-fpm","tag-cache-php","tag-opcache","tag-opcache_reset","tag-php-fpm","cat-165-id","cat-41-id","cat-2-id","cat-12-id","cat-162-id","has_thumb"],"_links":{"self":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/379","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/comments?post=379"}],"version-history":[{"count":3,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/379\/revisions"}],"predecessor-version":[{"id":383,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/posts\/379\/revisions\/383"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media\/456"}],"wp:attachment":[{"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/media?parent=379"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/categories?post=379"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/hackerzone.com.br\/blog\/wp-json\/wp\/v2\/tags?post=379"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}