从命令行和Http端执行php的区别 [英] Difference between executing php from the commandline and from the Http Side

查看:242
本文介绍了从命令行和Http端执行php的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从命令行和HTTP执行php有什么区别?他们是否使用相同的可执行文件,例如(php.exe或php-cgi.exe(Apache或IIS))?从命令行或HTTP执行结果是否有所不同?

What is the difference between executing php from command line and from HTTP? Do they use the same executable such as (php.exe or php-cgi.exe ( Apache or IIS ))? Do the results differ when they are executing from command line or HTTP?

推荐答案

没有html标记错误
这是php.ini设置( html_errors ) ,但在cli版本中默认为关闭.

No html markup in errors
This is a php.ini setting(html_errors), but this defaults to off in the cli version.

登录到stderr
通常,错误会记录到Web服务器的error.log中,但是在cli版本中,错误会写入stderr.
这也可以作为php.ini设置使用( error_log )

Logging to stderr
Usually errors are logged to the webservers error.log, but in the cli version errors are written to stderr.
This is also available as a php.ini setting(error_log)

php.ini
用于cli版本的php.ini文件可以是其他文件.可能会导致一些令人讨厌的错误(卷曲突然不可用,等等).

php.ini
The php.ini file that is used for the cli version can be a different file. Which can lead to some nasty bugs (curl suddenly not available, etc).

不同的可执行文件
可以安装多个版本的php(php5和php4)
使用which php确定您使用的版本.

Different executables
It's possible to install multiple version of php (php5 alongside php4)
Use which php to determine which version you're using.

所有内容均显示为文本
无需<pre>
即可读取var_dump() header('Hello');echo('Hello');

Everything is shown as text
var_dump() is readable without a <pre>
No difference between header('Hello'); and echo('Hello');

这篇关于从命令行和Http端执行php的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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