Monthly Archives: September 2013

Quick tip: How to run php script like application

It’s really quick tip:
Sometimes you need to make a shell script which need to be executed either on regular basis, or like infinite loop.

You always can run it by:

/usr/bin/php /path/to/script.php

but if you add a shebang line, the script can be run as standalone application.

Example:

#!/usr/bin/php -q
<?php
//Your php code goes there
?>

Then you can run it like:

/path/to/script.php

Hope this helps