php - fwrite to STDERR resulting in error in executable script -
i have strange issue. in executable php script error happens, , have no idea why
warning: fwrite() expects parameter 1 resource, string given
i have following examples:
-rwxr-xr-x 1 root root 87 sep 10 16:55 test* -rw-r--r-- 1 root root 33 sep 10 17:10 test.php
where file ./test is:
#!/usr/bin/php -q <?php fwrite(stderr, "test\n");
and file test.php (exact same, missing shebang):
<?php fwrite(stderr, "test\n");
i made tests on machine , it's behavior strange:
# ./test <br /> <b>warning</b>: fwrite() expects parameter 1 resource, string given # php -q test.php test # php -r 'fwrite(stderr, "test\n");' test
has idea why fwrite stderr not work (only) in executable php files?
php 5.4.28 (cli) (built: may 19 2014 15:39:12)
the error gone when use shebang #!/usr/local/bin/php
. makes sense, since php compiled source.
but still don't understand why happens on other path. tried phpinfo using 'wrong' shebang , still php version 5.4.28
version, there aren't multiple installations.
Comments
Post a Comment