Page 1 of 1
Does the shebang line work with php?
Posted: Tue Apr 20, 2004 9:30 pm
by Ixplodestuff8
if I had a script like this:
and access the file directly would it run correctly?
Posted: Wed Apr 21, 2004 1:51 am
by Coco
not wanting to seem rude, but in my opinion, the easiest way to learn has always been to try it myself
try running file something like this:
Code: Select all
#!/usr/bin/php
<?php
echo 'it works!';
?>
Posted: Wed Apr 21, 2004 4:28 pm
by Ixplodestuff8
Yeah trying it out myself is the best way, but since It was late, I just posted the question to see if it was answered the next day, so I didn't have to test it out myself. (lazyness

)
And BTW it does work

, of course it does have the php headers in it, but those can be turned off in the php.config, and the script I'm writing doesn't have any output so I can just direct output to /dev/null.
Posted: Wed May 12, 2004 10:43 am
by dave420
Just add -q to the /usr/bin/php, and it'll turn off the headers. This works fine for linux and mac OSX, and with a .bat companion for windows, can let you make portable scripts which work on macs, windows and linux (I wrote a few for my ipod, and it's all portable (in every sense of the word)

)