osTicket, wget, crontab and FastCGI
Par Mathieu le samedi 29 juin 2013, 23:27 - Hacks - Lien permanent
After a long night trying to get HTTP cron for osTickets to work, here is my solution :
Things to know
- Rewritting the URLs of a FastCGI-running PHP application, using Apache2 mod_rewrite on PATH_INFO is broken, it does not work. Never.
- osTicket needs POST requests to its API.
- osTicket uses an unsafe way to get PATH_INFO, obviously it will not work with FastCGI.
How to get it work
Open includes/class.osticket.php
Replace :
//TODO: conruct possible path info.
With :
$path_info = str_replace(BASE_URI."/", "", $_SERVER['REQUEST_URI']);
if (!empty($path_info))
return $path_info;
And call the cron like that :
/usr/bin/wget -q --no-cache -O /dev/null --post-data '' --header='X-API-Key:your_api_key_here' 'http://example.com/api/http.php/tasks/cron'