Prevent #!/usr/bin/php from showing when accessing file

Hello

I have a PHP file which I am using to pipe a email messages to, but also at the same time, the same file can be access by http.

In order for the pipe to work, I had to put the following hashbang in the first line of the code


#!/usr/bin/php -q

However, I don’t want this text to show up if I access the file using a link through the browser.

Is there any parameter to the hashbang that hides it from display?

Thank you

I don’t know about hiding it from display. But can’t you create two PHP files, one that runs from the browser, and the other one calling the browser file with a shebang ?

i.e. :

file_to_show_in_browser.php


<?php
doSomeStuff();
?>

file_to_use_in_cli.php


#!/usr/bin/php -q
include "file_to_show_in_browser.php"

That would do what you want, wouldn’t it?