I’m trying to set up a cron job for my osTicket, but it continuously fails. I use a shared hosting solution with webspace, databases and cron jobs with STRATO.
osTicket is located in <ROOT>/<MYWEBSITE>/osticket
Main information about server and software:
osTicket Version: v1.12.3 (bcf1a6f) — Up to date
Web Server Software: Apache/2.4.41 (Unix)
MySQL Version: 5.6.42
PHP Version: 7.3.10
Emails > Setting > Email Fetching: [CHECK] Enable
With this osTicket alone works perfectly fine. So I tried to set up a cronjob using the cron job interface in my STRATO account. I put in the command line:
/bin/php -f ./<MYWEBSITE>/osticket/api/cron.php
With this schema other cron job/php scripts work quite fine. But with this osTicket cron job I always get a notification via email with
PHP Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in /mnt/<ROOTPATH>/htdocs/<MYWEBSITE>/osticket/bootstrap.php on line 19
PHP Warning: session_cache_limiter(): Cannot change cache limiter when headers already sent in /mnt/<ROOTPATH>/htdocs/<MYWEBSITE>/osticket/bootstrap.php on line 21
cron.php only supports local cron calls - use http -> api/tasks/cron
No emails are fetched and no tickets created.
Running cron.php with fetching email works though when I use this command via SSH:
bin/php/ <MYBWESITE>/osticket/api/cron.php
I tried a lot and found that the cron.php works with in a cron job when I remove
if (!osTicket::is_cli())
die(__('cron.php only supports local cron calls - use http -> api/tasks/cron'));
from cron.php. But I don’t think it’s good idea to change the core code.
In addition, I set up rcron.php (which works) but I don’t have a stabile unique IP address that I can use for generating the API. So I have to stick to a cron job with STRATO.
I would be very happy if anyone can help me and tell we what’s going wrong. Thank you!