PHP 7.1+ Windows readline扩展并非所有功能都存在 [英] PHP 7.1+ Windows readline extension not all functions exist
问题描述
PHP7.1的一项改进是,在Windows中可以立即使用readline扩展.我在使用所有功能时遇到了麻烦,因为它们并不全部存在.以下代码:
One of the improvements in PHP7.1 is that in Windows the readline extension is available out of the box. I'm having trouble using all of the functions though, as they don't all exist. The following code:
$functions = [
'readline_add_history',
'readline_callback_handler_install',
'readline_callback_handler_remove',
'readline_callback_read_char',
'readline_clear_history',
'readline_completion_function',
'readline_info',
'readline_list_history',
'readline_on_new_line',
'readline_read_history',
'readline_redisplay',
'readline_write_history',
'readline'
];
foreach($functions as $function) {
echo $function . (function_exists($function) ? ' exists' : ' does not exist') . PHP_EOL;
}
...产生以下输出:
...produces the following output:
readline_add_history exists
readline_callback_handler_install does not exist
readline_callback_handler_remove does not exist
readline_callback_read_char does not exist
readline_clear_history exists
readline_completion_function exists
readline_info exists
readline_list_history does not exist
readline_on_new_line does not exist
readline_read_history exists
readline_redisplay does not exist
readline_write_history exists
readline exists
我在 PHP手册中找不到任何参考文献, Windows中提供了readline扩展功能的一部分.
I can't find any reference in the PHP manual that only a subset of the readline extension's functions are available in Windows.
当我呼叫php_info()
时,得到以下输出:
When I call php_info()
, I get the following output:
阅读行
已启用Readline支持
Readline Support enabled
Readline库WinEditLine
Readline library WinEditLine
是否需要进行一些php.ini配置设置(或CLI参数)才能使所有功能可用?另外,还有其他方法可以使诸如readline_callback_handler_install()
之类的功能在Windows中可用,还是该扩展名只是半熟而已?
Is there some php.ini configuration setting (or CLI argument) that needs to be made in order to make all functions available? Alternately, is there some other way of making functions such as readline_callback_handler_install()
available in Windows, or is the extension only half-baked?
推荐答案
最初,我认为您可能已经陷入了缺少这些功能的古老PHP 5.0中,但是如果我失败了,我将不得不猜测您的PHP二进制文件是针对不支持这些功能所依赖的功能的基础库(或其版本)编译的.
Initially I thought that you might have been somehow falling through to an ancient PHP 5.0 which lacks those functions, but failing that I would have to guess that your PHP binary was compiled against an underlying library [or version thereof] that doesn't support the feature that those functions depend on.
交叉引用 ext/readline/readline.c
我想您可能缺少与HAVE_LIBEDIT
相对应的功能/blob/master/ext/readline/config.m4"rel =" nofollow noreferrer> ext/readline/config.m4
.
Cross-referencing the list of functions that are missing with ext/readline/readline.c
I would guess you're missing features corresponding to the constants/features HAVE_RL_CALLBACK_READ_CHAR
and HAVE_LIBEDIT
defined in ext/readline/config.m4
.
TL; DR:编译您的PHP的人都需要弄清楚它. [大概]
TL;DR: Whoever compiled your PHP needs to figure it out. [probably]
这篇关于PHP 7.1+ Windows readline扩展并非所有功能都存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!