SSH to the webserver, find the appropriate path to PHP (you can google if you don’t know as it will be specific to your setup - on Linux you can typically run whereis php
and it will give you a path), cd
to your osTicket directory, and run the command you tried earlier after replacing php
with your PHP path.
Cheers.