Archive : php > bash?

date: 8:48pm, 27.03.2006 (gmt+12).

i make no secret of the fact that i'm not enamoured with bash scripting. bash is a great shell, and i wouldn't use anything else, despite several alternatives (most notably fish), but having been never educated on the subtlties of bash scripting, i've never enjoyed it as much as other languages.

imagine my excitement then, when i learned of a simple trick to make binary executable php scripts, in many cases allowing for similar jobs to be done, but without the strange and archaic scripting syntax.

simply put the path to the php executable at the start of your php file in the following format:

 

#!/usr/local/php

 

before your opening <?php tag, and chmod the php file in question to executable. you should now be able to execute the php file in much the same manner you would execute a .sh shell script.

this is probably not an earth-shattering revelation for those of you out there who are more familiar with php, but when you're new to php or linux in general, every advantage helps.

 

- adrian