Some PHP installations are just borked when it comes to this setting. I notice this more often with IIS (windows) vs say CentOS (linux). You'll need to read guides/docs online for your specific setup to see how to address this.
As for the pages taking a long time to load, have you checked the server resources when it's being slow? Are the CPU and RAM usages high when it's slow? Are there any long running queries in the database? These are the types of questions you will need to ask yourself and figure out. Also, if you haven't done so already, I'd highly recommend scanning your database to make sure all the tables in the osTicket database are set to InnoDB (NOT MyISAM). InnoDB brings way better performance/speed than MyISAM. I've also seen people say upgrading to MySQL 8.0 is way faster than previous versions.