note 111816 added to features.commandline.usage

From: Date: Mon, 01 Apr 2013 04:44:01 +0000
Subject: note 111816 added to features.commandline.usage
Groups: php.notes 
Request: Send a blank email to php-notes+get-194282@lists.php.net to get a copy of this message
On Linux, the shebang (#!) line is parsed by the kernel into at most two parts. For example: 1: #!/usr/bin/php 2: #!/usr/bin/env php 3: #!/usr/bin/php -n 4: #!/usr/bin/php -ddisplay_errors=E_ALL 5: #!/usr/bin/php -n -ddisplay_errors=E_ALL 1. is the standard way to start a script. (compare "#!/bin/bash".) 2. uses "env" to find where PHP is installed: it might be elsewhere in the $PATH, such as /usr/local/bin. 3. if you don't need to use env, you can pass ONE parameter here. For example, to ignore the system's PHP.ini, and go with the defaults, use "-n". (See "man php".) 4. or, you can set exactly one configuration variable. I recommend this one, because display_errors actually takes effect if it is set here. Otherwise, the only place you can enable it is system-wide in php.ini. If you try to use ini_set() in your script itself, it's too late: if your script has a parse error, it will silently die. 5. This will not (as of 2013) work on Linux. It acts as if the whole string, "-n -ddisplay_errors=E_ALL" were a single argument. But in BSD, the shebang line can take more than 2 arguments, and so it may work as intended. Summary: use (2) for maximum portability, and (4) for maximum debugging. ---- Server IP: 69.147.83.199 Probable Submitter: 87.194.171.29 ---- Manual Page -- http://php.net/manual/en/features.commandline.usage.php Edit -- https://master.php.net/note/edit/111816 Del: integrated -- https://master.php.net/note/delete/111816/integrated Del: useless -- https://master.php.net/note/delete/111816/useless Del: bad code -- https://master.php.net/note/delete/111816/bad+code Del: spam -- https://master.php.net/note/delete/111816/spam Del: non-english -- https://master.php.net/note/delete/111816/non-english Del: in docs -- https://master.php.net/note/delete/111816/in+docs Del: other reasons-- https://master.php.net/note/delete/111816 Reject -- https://master.php.net/note/reject/111816 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#194282) next »