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
Main difference is argument passing: running from the CLI, you don't have $_GET, $_POST, $_SESSION, etc; so arguments have to be passed as command line parameters and accessed using if $_SERVER['argc'] and $_SERVER['argv']
Watch out for the directory your code is running in and the include path; and make sure you know what php.ini you've loaded.
When outputting, HTML markup doesn't render as markup, but displays as < h1> etc.... watch out particularly for
(PHP_EOL is extremely useful) and multiple spaces or tabs actually appear as multiple spaces or tabs rathe rthan a single space.
Forget headers() and other http-specific functions