How to run a php script on a Linux shell as a normal script:

-name of the script:    script_name.php

-Inside the script:

#!/usr/bin/php

<?php

Here you can insert your php code

?>

-On the shell:

  • chmod +x script_name.php
  • ./script_name.php

-Done!!