首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法在AlmaLinux和PHP8上启用Zend AlmaLinux

无法在AlmaLinux和PHP8上启用Zend AlmaLinux
EN

Stack Overflow用户
提问于 2021-08-08 17:30:15
回答 1查看 2.6K关注 0票数 0

我使用的是AlmaLinux 8.4,我试图安装Zend并验证它是否正在运行。

在Easy中,安装了php8php80-php-opcachephp -1显示Zend未启用,而php -a已启用,10-opcache.ini已加载。(我看到CLI没有启用,但我不需要它。)

Apache和PHP已经被重新启动了好几次。

这个配置正确吗?

如何确定Zend是否实际运行?

[root}# php -i显示:

代码语言:javascript
复制
Zend OPcache

Opcode Caching => Disabled
Optimization => Disabled
SHM Cache => Enabled
File Cache => Disabled
JIT => On
Startup Failed => Opcode Caching is disabled for CLI

代码语言:javascript
复制
Loaded Configuration File => /opt/cpanel/ea-php80/root/etc/php.ini
Additional .ini files parsed => /opt/cpanel/ea-php80/root/etc/php.d/10-opcache.ini

代码语言:javascript
复制
Core

PHP Version => 8.0.9

zend.assertions => -1 => -1
zend.detect_unicode => On => On
zend.enable_gc => On => On
zend.exception_ignore_args => Off => Off
zend.exception_string_param_max_len => 15 => 15
zend.multibyte => Off => Off
zend.script_encoding => no value => no value
zend.signal_check => Off => Off

/opt/cpanel/ea-php80/root/etc/php.d/10-opcache.ini文件显示

代码语言:javascript
复制
Enable Zend OPcache extension module
zend_extension=opcache.so

; Determines if Zend OPCache is enabled
opcache.enable=1

; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0

; 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 100000 are allowed.
opcache.max_accelerated_files=4000

php -a显示

代码语言:javascript
复制
php > print_r(opcache_get_configuration());
Array
(
    [directives] => Array
        (
            [opcache.enable] => 1
            [opcache.enable_cli] => 
            [opcache.use_cwd] => 1
            [opcache.validate_timestamps] => 1
            [opcache.validate_permission] => 1
            [opcache.validate_root] => 
            [opcache.dups_fix] => 
            [opcache.revalidate_path] => 
            [opcache.log_verbosity_level] => 1
            [opcache.memory_consumption] => 134217728
            [opcache.interned_strings_buffer] => 8
            [opcache.max_accelerated_files] => 4000
            [opcache.max_wasted_percentage] => 0.05
            [opcache.consistency_checks] => 0
            [opcache.force_restart_timeout] => 180
            [opcache.revalidate_freq] => 2
            [opcache.preferred_memory_model] => 
            [opcache.blacklist_filename] => /opt/cpanel/ea-php80/root/etc/php.d/opcache*.blacklist
            [opcache.max_file_size] => 0
            [opcache.error_log] => 
            [opcache.protect_memory] => 
            [opcache.save_comments] => 1
            [opcache.record_warnings] => 
            [opcache.enable_file_override] => 
            [opcache.optimization_level] => 2147401727
            [opcache.lockfile_path] => /tmp
            [opcache.file_cache] => 
            [opcache.file_cache_only] => 
            [opcache.file_cache_consistency_checks] => 1
            [opcache.file_update_protection] => 2
            [opcache.opt_debug_level] => 0
            [opcache.restrict_api] => 
            [opcache.huge_code_pages] => 
            [opcache.preload] => 
            [opcache.preload_user] => 
            [opcache.jit] => tracing
            [opcache.jit_buffer_size] => 0
            [opcache.jit_debug] => 0
            [opcache.jit_bisect_limit] => 0
            [opcache.jit_blacklist_root_trace] => 16
            [opcache.jit_blacklist_side_trace] => 8
            [opcache.jit_hot_func] => 127
            [opcache.jit_hot_loop] => 64
            [opcache.jit_hot_return] => 8
            [opcache.jit_hot_side_exit] => 8
            [opcache.jit_max_exit_counters] => 8192
            [opcache.jit_max_loop_unrolls] => 8
            [opcache.jit_max_polymorphic_calls] => 2
            [opcache.jit_max_recursive_calls] => 2
            [opcache.jit_max_recursive_returns] => 2
            [opcache.jit_max_root_traces] => 1024
            [opcache.jit_max_side_traces] => 128
            [opcache.jit_prof_threshold] => 0
        )

    [version] => Array
        (
            [version] => 8.0.9
            [opcache_product_name] => Zend OPcache
        )

    [blacklist] => Array
        (
        )

)
EN

回答 1

Stack Overflow用户

发布于 2021-08-12 17:38:13

要确定opcache是否启用和工作,并确保JIT实际工作,请创建一个可通过浏览器访问的opcache_get_status()脚本,并查看opcache_get_status()的输出。

示例PHP文件可以是:

代码语言:javascript
复制
var_dump(opcache_get_status());

启用时的示例输出如下:

代码语言:javascript
复制
array(9) {
  ["opcache_enabled"]=>
  bool(true)
...

如果未安装或未启用opcache扩展,它将引发此错误:

代码语言:javascript
复制
Fatal error:  Uncaught Error: Call to undefined function opcache_get_status()

另一种选择是打印出phpinfo并检查输出中的opcache:

代码语言:javascript
复制
<?php phpinfo(); ?>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68703172

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档