I want to run a php script using cron job on localhost
my script is situated at -
now as opt is under root, i tried adding the cron job for root as well as normal user but its not executing.
here is my cron job for executing the PHP script every 2 mins.
*/2 * * * * php /opt/lampp/htdocs/rrugd/myscript.php
my script is basically meant to truncate a table from the database.It will actually be happening at midnight , so the actual variables of cron job will change to
00 00 * * * php /path/to/script.php
but for testing ive used every 2min.
Ive searched on the internet and ask ubuntu, but i cant get it to run. i saw something related to setting a PATH but i didnt understand what is to be done exactly in that method.
Also, i would like to specify that the PHP script myscript.php DID NOT execute on CLI with the PHP command. But it does execute when executed or called through the browser on localhost!
what am i exactly doing wrong? ive spent last 2/3 hours on this! i am using cron job 1st time.
php version -
some@somepc$: php -v PHP 5.5.3-1ubuntu2.2 (cli) (built: Feb 28 2014 20:06:05) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies