When running from the CLI, PHP exhibits some different behaviours than when run from a web server. These differences should be kept in mind, especially in the case where the same script might be run from both environments.
require("./stuff.inc");assumes the file is in the same directory as the script. On the command line, the current working directory is the directory you're in when you call the script. Scripts that are going to be called from the command line should always use absolute paths. (Note the magic constants
__FILE__continue to work as expected, and return the location of the script.)
true, respectively. Buffering is still available, but must be explicitly enabled, otherwise output will always be displayed in real time.
max_execution_timeis set to zero, so scripts will not time out by default.
html_errors, it will be ignored on the command line.
php.inican be loaded. When you are using php from cli it can use different
php.inithan web server do. You can know what file is using by running