File must start with declaration code and PHP start tag:

#!/usr/bin/php
<?php

File must end with PHP end tag:

?>

In the middle you can put all PHP code you want and remember that parameters are passed via the variable:

$argv[]

Di paolo