且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从命令行和Http端执行php的区别

更新时间:2023-02-20 08:46:02

没有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');