Difference between executing php from the commandline and from the Http Side

后端 未结 7 1671
余生分开走
余生分开走 2020-12-09 18:32

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 r

7条回答
  •  Happy的楠姐
    2020-12-09 19:14

    Whether PHP is invoked via a web server module or CLI, the same binary base is used (but can sometimes be configured to use different ini's which can affect the script). It's environment will also be different so environment variables will not be exact.

    PHP is also aware that it's been invoked differently and will tailor it's output to suit that (i.e., phpinfo(); output will be formatted differently when called via CLI).

提交回复
热议问题