Good morning everyone
plz i want to know how to create a cron job using php function and also how to stop this cron from working using php...
all that i need is to create a cron job using php and when the administrator press send -> the cron will be execute
and when he press stop -> the cron will be deleted from cpanel

note that: the administrator does not have an access to the cpanel and also if he has .. he can not deal with it.

PHP Code:

function crontab_set ($min, $hour, $monthDay, $monthNum, $weekDay)

    $command = "$min $hour $monthDay $monthNum $weekDay /usr/local/bin/php -f /home/egypthol/public_html/snd2.php";
    echo $command;
    $cron_file = "Feed_cron"; 
    // check for cron/Feed_cron file. If it doesn't exist create it.
    // you must create the file from the browser to associate the proper group
    if (file_exists($cron_file))
        {  // if it exists, write new command
        $open = fopen($cron_file, "w"); // This overwrites current line
        fwrite($open, $command);
        // this will reinstate your Cron job
        exec("crontab /home/egypthol/public_html/cron/Feed_cron") or die ("<br><br>Error in executing Cron file");

        { // if it Doesn't exist, Create it then write command
        touch($cron_file); // create the file, Directory "cron" must be writeable
        chmod($cron_file, 0700); // make new file writeable
        $open = fopen($cron_file, "w");
        fwrite($open, $command);
        // start the cron job!
        exec("crontab /home/egypthol/public_html/cron/Feed_cron")or die ("<br><br>Error in creating Cron file");


this is my code... and it makes the file Feed_cron and make inside it the commad

but there is an error in the exec line coz when the page is loaded the die message ("Error in executing Cron file") appears.. so i found that the error is in the execute line
could u plz help me in solving this problem

plz take a look on these 2 links: --> this is the page that creates the cron job file and when wirting exec it shows the die error --> shows the sever details

plz i need help in solving this problem , if anyone can help me or send for me full example of creating cron job from php file