Posts Tagged ‘php scripts’

Executing PHP script from command line

This item was filled under [ PHP ]

Executing PHP scripts from command line is quite easy. You just need to know the right commands to execute your script. This procedure comes in handy while developing command line scripts.
*NIX OS:
/path/to/php -f /path/to/script.php
Windows OS:
X:\path\to\php.exe -f X:\path\to\script.php
-f parses and executes <file>. For a list of command line parameters, visit:
PHP: Using PHP from the command [...]

Continue reading...

Executing SHELL commands with PHP

This item was filled under [ PHP ]

My last post discusses executing batch file in .Net. And the process does use couple of crappy .Net lines! But the same can be done with PHP only in 1 line
<?php
$output = shell_exec('ls -lart');
echo "<pre>$output</pre>";
?>
For more details, read here.

Continue reading...