[A SOLUTION - NOT SOLVED] Troubleshooting Cron.php

Hello,

I’m running 10.1.0 of ownCloud and have tried to setup the cron.php to use Cron. In the General admin section I have selected CRON. Then I put the following command line in the user cron for the account that the ownCloud is installed in. Its a cPanel server.

*/15 * * * * php -f /home/example/public_html/cron.php

Also tried

*/15 * * * * sudo -u example php -f /home/example/public_html/cron.php

When left for CRON to run I get cron error internal server error sent to the hosting account email address.

However, If login via SSH and execute php -f /home/example/public_html/cron.php at the command line the command functions without error and the admin area indicates the last time cron ran was the time I manually ran the command via ssh.

Any thoughts?

  • Mike

I think it should be the apache user.

# crontab -l -u www-data
# m h  dom mon dow   command
*/15  *  *  *  * /usr/bin/php -f /var/www/html/owncloud/cron.php
1 Like

Hello,

I’ll try that. The server is running is Switch user PHP environment where PHP switches to the user account that is calling the PHP file.

I’ll try the generic apache account next.

  • Mike

Hello,

I ended up writing a php script with cURL to call it via an HTTP call.

I know I should not have to, but the cron was only throwing error and the HTTP call seems to work just fine.

So ad odd as it seems I call the curl script to call the cron via HTTP.

    <?

  // create curl resource 
        $ch = curl_init(); 

        // set url 
        curl_setopt($ch, CURLOPT_URL, "https://example.net/cron.php"); 

        //return the transfer as a string 
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 

        // $output contains the output string 
        $output = curl_exec($ch); 

        // close curl resource to free up system resources 
        curl_close($ch);      

?>

Hmm, using an external webcron service isn’t an option for you?

It’s just one less account to manage. I still think it strange that the cron.php will run correctly when called from the command line manually but not in the crontab. This is just a work around since the ajax and web cron seem to work fine. The cURL script just makes it work on the server with no other accounts necessary.

Thanks. Mike

Did you consider switching to anther server or hosting? Maybe you current one isn’t well enough for running ownCloud.

1 Like

Hello,

Is my dedicated server. We have other system running on it and wanted to do some testing before paying for other hosting.

I think when we go to deploy this in a live scenario we may go with amazon EC2 and S3 cloud.

I only wanted to create a beta environment to get a few people to use it and give feedback.

Thanks,
Mike