run cron in php code example
Example 1: cron run php script
# -q is for quiet mode
php -q ${HOME}/public_html/script.php
# if needed by your script:
cd ${HOME}/public_html/; php -q script.php
# with a config file:
php -c ${HOME}/php.ini ${HOME}/public_html/script.php
Example 2: cron.php
$time = date("G:i:s");
$entry = "Información guardada a las $time.\n";
$file = "/var/www/testdir/test.cron.txt";
$open = fopen($file,"a");
if ( $open ) {
fwrite($open,$entry);
fclose($open);
}