PHP doesn't have to run in a web page although it's an interpreted scripting language. i.e. It is read and executed and then it is done with.
You can also run PHP as a CLI application by passing it through the php interpreter.
To save that hassle you can add the shebang line:
Code: Select all
#!/usr/bin/php
<?php
echo "Hello World!\n";
?>
and chmod +x it so it can execute then after that you just point to it (or put a symbolic link in your bin dir if you prefer). You don't even s read and executed and then it is done with.
You can also run PHP as a CLI application by passing it through the php interpreter.
To save that hassle you can add the shebang line:
Code: Select all
#!/usr/bin/php
<?php
echo "Hello World!\n";
?>
and chmod +x it so it can execute then after that you just point to it (or put a symbolic link in your bin dir if you prefer). You don't even need the .php extension if you add the shebang
[Um... I think I've wandered off-topic here

]
Should you need something regularly repeated, use CRON to re-run it at set intervals. PHP isn't the t5a9]
To save that hassle you can add the shebang line:
Code: Select all
#!/usr/bin/php
<?php
echo "Hello World!\n";
?>
and chmod +x it so it can execute then after that you just point to it (or put a symbolic link in your bin dir if you prefer). You don't even need the .php extension if you add the shebang
Code: Select all
-- bash -$ with.
You can also run PHP as a CLI application by passing it through the php interpreter.
[code]
-- bash -$ php phpfile.php
[/code]
To save that hassle you can add the shebang line:
[php]
#!/usr/bin/php
<?php
echo "Hello World!\n";
?>
[/php]
and chmod +x it so it can execute then after that you just point to it (or put a symbolic link in your bin dir if you prefer). You don't even need the .php extension if you add the shebang ;)
[code]
-- bash -$ ./file.php
[Um... I think I've wandered off-topic here

]
Should you need something regularly repeated, use CRON to re-run it at set intervals. PHP isn't the tool for everything server side, but it is pretty diverse. If it doesn't do what you need you'll have to look at other languages.