phpinfo()和有什么不一样?和php -i? [英] What is the difference between phpinfo(); and php -i?

查看:249
本文介绍了phpinfo()和有什么不一样?和php -i?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搜索DDG,在这里没有得到任何有趣的结果.我听说它们是不同的,但是我想知道是什么使它们与众不同,以及具有两种不同的配置有什么优势?

编辑:是的,我都在CLI上运行它们.

解决方案

phpinfo()是一种语言功能,无论通过Web SAPI还是从CLI调用执行该脚本的脚本,它都会显示其输出;

php -i纯粹是一个命令行开关,用于从命令行获取有关PHP的信息.

为什么Web sapi和CLI的配置不同?因为您可能有不同的要求;开发人员通常会运行较长的命令行脚本,并且不希望应用Web sapi超时,这与内存设置类似;和最大文件/帖子大小ini设置对CLI毫无意义,那么为什么只在需要Web时才在cli ini文件中添加它们?

Search on DDG and in here didn't get any interesting results. I've heard they're different, but I want to know what makes them different and what advantage is there in having two different configurations ?

EDIT : Yes, I am running them both from the CLI.

解决方案

phpinfo() is a language function that will display its output regardless of whether the script that it's executed in is called through the web SAPI or from CLI;

php -i is purely a command line switch to get information about PHP from the command line.

Why different configurations for web sapi and for CLI? Because you might have different requirements; often devs will run long command line scripts and don't want the web sapi timeout applied, similarly with memory settings; and max file/post size ini settings are meaningless for CLI, so why bother having them in the cli ini file when they're only needed for the web?

这篇关于phpinfo()和有什么不一样?和php -i?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆