PlayTube Cron Essentials: What Runs in the Background

PlayTube relies on scheduled tasks to handle critical operations that can't execute during normal page loads. The cronjob.php file, which must run every 15 minutes, processes video conversions, cleans dead files, sends notifications, and manages automated imports. Without proper cron configuration, you'll encounter stalled video processing, undelivered notifications, and bloated storage from unconverted temporary files.

Shared hosting users face unique constraints: no SSH access means traditional crontab -e isn't available. Instead, you'll use cPanel's Cron Jobs interface (under Advanced) or DirectAdmin's Cron Job Manager (under Account Manager). Both allow setting the required 15-minute interval without shell access.

Configuring Cron in cPanel & DirectAdmin

For cPanel:

  1. Navigate to Advanced > Cron Jobs
  2. Under Add New Cron Job, set */15 * * * * as the schedule
  3. In the command field, enter: php -f /home/YOUR_USERNAME/public_html/cronjob.php (replace YOUR_USERNAME with your actual cPanel username)
  4. Select Add New Cron Job

For DirectAdmin:

  1. Go to Account Manager > Cron Jobs
  2. Click Add Cron Job
  3. Set minutes to */15 and leave other fields as *
  4. Enter the command: /usr/local/bin/php /home/YOUR_USERNAME/domains/YOUR_DOMAIN/public_html/cronjob.php
  5. Save changes

After setup, verify execution by checking PlayTube's Admin Panel > CronJob Settings for timestamps. If the Last Run field updates, your cron is active.

Troubleshooting Failed Cron Execution

When cron jobs fail silently, follow this diagnostic path:

  1. Check cron email output: Both cPanel and DirectAdmin send execution logs to your account's primary email. Look for PHP memory limit errors or path issues.
  2. Review PlayTube's internal logs: Navigate to Admin Panel > System Logs > Cron Logs for script-specific errors.
  3. Test manual execution: Visit https://yourdomain.com/cronjob.php in a browser. A blank page indicates successful execution, while errors will display.
  4. Adjust PHP version: In cPanel's MultiPHP Manager or DirectAdmin's PHP Version Selector, ensure your site uses PHP 7.4 or 8.0 (required by PlayTube 3.1.1).

For memory-related failures, create a .user.ini file in PlayTube's root directory with:

memory_limit = 256M
max_execution_time = 180

Managing Imports & Notifications

PlayTube's cron handles two critical background processes:

1. Video Imports: When using Admin Panel > Videos > Import Videos with Auto Import enabled, cronjob.php processes the queue. If imports stall:

  • Verify YouTube/Dailymotion API keys in Admin Panel > Settings > Import & Upload Configuration
  • Check ./sources/import_logs/ for error files via File Manager

2. Notifications: Email alerts and OneSignal pushes depend on cron. If users report missing alerts:

  • Confirm SMTP settings in Admin Panel > Settings > E-mail Setup
  • For OneSignal, validate App ID and API Key in Mobile & API Settings > Push Notifications
  • Check ./sources/notifications_logs/ for delivery attempts

For recurring issues, consider enabling Admin Panel > Settings > CronJob Settings > Debug Mode to log detailed processing data.