I have the code for cron job but i don't know where place this code in my project folder.
The code is:
00 * * * * /usr/local/bin/php /home/cnl/myscript.php
I have the code for cron job but i don't know where place this code in my project folder.
The code is:
00 * * * * /usr/local/bin/php /home/cnl/myscript.php
No, You can't. You can't place OS(crontab) configuration code to PHP code and expect that it will manage your OS. But You can:
1) Create method at CodeIgniter's controller (for example at application/controllers/welcome.php
create
function hello(){
echo "I'm a function!";
}
and then call it from command line as
cd /your/path/to/codeigniter/ && php5 index.php welcome hello
If it works correctly, add this task to You crontab via command line or some GUI (cPanel/ISPManager/VestaCP/etc)
2) If You need to add Your line to cron and in fact Your question is not connected to CodeIgniter, I advice You to search "how to add cron job?", You'll find many results