Important question

hi everyone… please i want to know how to create a cron job from a file in php i made this command but it does not get any response. it get the error die message

i made it in php and i serched online in google and many websites and i did not solve my problem

my php command is:

exec("crontab -e * * * * * /usr/local/bin/php -f /home/survey/public_html/john/cron/snd2.php") or die ("<br><br>Error in executing Cron file");

so i want to create or use my cron job using php… any help

If you want to run the PHP script (snd2.php) directly from browser or so, then what is the meaning of running it via cron? The cron settings are usually done from the control panel and they are run in some time interval. If you want to run the script snd2.php then why not directly hit the file from browser since it is within the web directory?

look, i want to set a cronjob to do a task without the need to run the file on browser… so every 60 minutes it will make this task…

so i need to make a cronjob to do it… but i want to make it without going to cpanel… i want only to run a php file to set this cronjob on server and to use it
… GOT IT?

When (or at what interval) your file which has your script ‘exec…’ will be executed/run?

look i need to set the cronjob without the need to go to my website i want the cron to run once an hour… but i dont know how to make it coz i dont have the right to access the cpanel… so i want to set this cronjob without the need to go to cpanel…

so used the command exec to solve my task… but i dont know the right command to make this task… so i wrote exec but if you have any other idea… try to tell me about it

The obvious solution that is most guaranteed a chance of success is to gain the right to access cpanel.

Failing that, you can put forward a case to the person who does have rights to access cpanel so that they can set up the cron job for you.

Failing that, man up and live with the situation that is at hand.