Reputation: 48
How can i run PHP Code from command line on Linux Server.
I have code which is a PHP Code I need to run that On linux as a cronjob.
Upvotes: 2
Views: 1998
Reputation: 3938
Run PHP code from command line on Linux:
$php code.php
Add PHP file to run as a cron job:
$crontab -e
Add the schedule to cron.
Ex:
1 0 * * * /usr/bin/php /var/www/code.php > /dev/null 2>&1
Upvotes: 3