AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / server / Perguntas / 1168577
Accepted
alancc
alancc
Asked: 2024-12-06 11:57:06 +0800 CST2024-12-06 11:57:06 +0800 CST 2024-12-06 11:57:06 +0800 CST

Opcache.php retorna uma página vazia

  • 772

Estamos usando PHP + FPM 8.2 + OPCache. No passado, usávamos https://www.repairrar.com/opcache.php para verificar seu status. Mas hoje ele retorna uma página vazia. Embora mostre uma página vazia, eu visualizo a fonte da página e vejo que seu conteúdo tem cerca de 3,3 MB, mas eles simplesmente não são exibidos no navegador. Eu tentei Chrome e FireFox, mas mostram conteúdo vazio.

Eu também escrevo um pequeno arquivo PHP

<?php
    echo '<pre>' , var_dump(opcache_get_status(false)) , '</pre>';
?>

Ao visitar https://www.repairrar.com/opcache-get-status.php , ele mostra que o OpCache está habilitado e sendo executado corretamente:

array(8) {
  ["opcache_enabled"]=>
  bool(true)
  ["cache_full"]=>
  bool(false)
  ["restart_pending"]=>
  bool(false)
  ["restart_in_progress"]=>
  bool(false)
  ["memory_usage"]=>
  array(4) {
    ["used_memory"]=>
    int(446911376)
    ["free_memory"]=>
    int(626183176)
    ["wasted_memory"]=>
    int(647272)
    ["current_wasted_percentage"]=>
    float(0.0602819025516510009765625)
  }
  ["interned_strings_usage"]=>
  array(4) {
    ["buffer_size"]=>
    int(134217728)
    ["used_memory"]=>
    int(52098200)
    ["free_memory"]=>
    int(82119528)
    ["number_of_strings"]=>
    int(242556)
  }
  ["opcache_statistics"]=>
  array(13) {
    ["num_cached_scripts"]=>
    int(10741)
    ["num_cached_keys"]=>
    int(15444)
    ["max_cached_keys"]=>
    int(130987)
    ["hits"]=>
    int(167134669)
    ["start_time"]=>
    int(1733489514)
    ["last_restart_time"]=>
    int(0)
    ["oom_restarts"]=>
    int(0)
    ["hash_restarts"]=>
    int(0)
    ["manual_restarts"]=>
    int(0)
    ["misses"]=>
    int(11569)
    ["blacklist_misses"]=>
    int(0)
    ["blacklist_miss_ratio"]=>
    float(0)
    ["opcache_hit_rate"]=>
    float(99.99307851607164820961770601570606231689453125)
  }
  ["jit"]=>
  array(7) {
    ["enabled"]=>
    bool(false)
    ["on"]=>
    bool(false)
    ["kind"]=>
    int(5)
    ["opt_level"]=>
    int(4)
    ["opt_flags"]=>
    int(6)
    ["buffer_size"]=>
    int(0)
    ["buffer_free"]=>
    int(0)
  }
}

E abaixo está o arquivo php.ini (eu verifiquei o histórico de alterações e ele não foi alterado desde que Opcache.php retornou conteúdo visível):

; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

allow_url_fopen = On
allow_url_include = Off
display_errors = Off
enable_dl = Off
file_uploads = On
max_execution_time = 1000
max_input_time = 1000
max_input_vars = 1000
memory_limit = 512M
post_max_size = 64M
session.gc_maxlifetime = 2880
#session.save_path = "/var/cpanel/php/sessions/ea-php72"
upload_max_filesize = 64M
zlib.output_compression = Off
session.save_path = "/var/cpanel/php/sessions/ea-php82"

; The gloabal 10-opcahce.ini has already enable opcache, so it is not necessary to enable it here again.
; Enable opcache here will cause 'Zend OPcache can't be temporary enabled' warning in PHP. So the following
; line is commented out
; opcache.enable=1

php
  • 1 1 respostas
  • 71 Views

1 respostas

  • Voted
  1. Best Answer
    Kiyomizu
    2024-12-14T21:22:52+08:002024-12-14T21:22:52+08:00

    Parece que o problema está em como a página está sendo renderizada no navegador, mesmo que o conteúdo ainda esteja lá. Você pode tentar limpar o cache do navegador ou desabilitar extensões para ver se isso ajuda. Além disso, testar a página em navegadores diferentes pode dar mais insights. Se isso não funcionar, verifique os logs do servidor para ver se há erros ou revise as configurações de PHP-FPM e memória, pois pode haver algo afetando como a página está sendo servida.

    Você está vendo uma página OPcache em branco, mas a fonte da página ainda tem conteúdo.

    Desabilitar buffer de saída:

    > ob_end_clean();   ob_implicit_flush(true);
    

    Defina o tipo de conteúdo correto: certifique-se de que a página seja renderizada como HTML

    header('Content-Type: text/html; charset=UTF-8');
    

    Habilitar Relatório de Erros: Ative o relatório de erros no seu script

    ini_set('display_errors', 1);
    error_reporting(E_ALL);
    

    Verifique as configurações do OPcache: Verifique se o OPcache está habilitado no php.ini

    opcache.enable = 1
    opcache.revalidate_freq = 0
    

    Limpe o cache do seu navegador ou teste no modo anônimo para evitar interferências.

    Execute este script básico para ver se a saída funciona:

    <?php
    echo "Starting...";
    var_dump(opcache_get_status(false));
    echo "Done.";
    

    Confirme se o OPcache está habilitado: php -i | grep opcache

    • 1

relate perguntas

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Você pode passar usuário/passar para autenticação básica HTTP em parâmetros de URL?

    • 5 respostas
  • Marko Smith

    Ping uma porta específica

    • 18 respostas
  • Marko Smith

    Verifique se a porta está aberta ou fechada em um servidor Linux?

    • 7 respostas
  • Marko Smith

    Como automatizar o login SSH com senha?

    • 10 respostas
  • Marko Smith

    Como posso dizer ao Git para Windows onde encontrar minha chave RSA privada?

    • 30 respostas
  • Marko Smith

    Qual é o nome de usuário/senha de superusuário padrão para postgres após uma nova instalação?

    • 5 respostas
  • Marko Smith

    Qual porta o SFTP usa?

    • 6 respostas
  • Marko Smith

    Linha de comando para listar usuários em um grupo do Windows Active Directory?

    • 9 respostas
  • Marko Smith

    O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL?

    • 3 respostas
  • Marko Smith

    Como determinar se uma variável bash está vazia?

    • 15 respostas
  • Martin Hope
    Davie Ping uma porta específica 2009-10-09 01:57:50 +0800 CST
  • Martin Hope
    kernel O scp pode copiar diretórios recursivamente? 2011-04-29 20:24:45 +0800 CST
  • Martin Hope
    Robert ssh retorna "Proprietário incorreto ou permissões em ~/.ssh/config" 2011-03-30 10:15:48 +0800 CST
  • Martin Hope
    Eonil Como automatizar o login SSH com senha? 2011-03-02 03:07:12 +0800 CST
  • Martin Hope
    gunwin Como lidar com um servidor comprometido? 2011-01-03 13:31:27 +0800 CST
  • Martin Hope
    Tom Feiner Como posso classificar a saída du -h por tamanho 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich O que é um arquivo Pem e como ele difere de outros formatos de arquivo de chave gerada pelo OpenSSL? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent Como determinar se uma variável bash está vazia? 2009-05-13 09:54:48 +0800 CST

Hot tag

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve