How to change the timezone for a single PHP file?

You can set a specific timezone for a PHP script using the following function which should be added to the PHP file:

putenv("TZ=US/Central");

This is just an example. The full list of supported timezones is available here. You should simply replace "US/Central" with the desired timezone.

If you wish to change the PHP timezone on a per-folder basis, please check this article for information how to do it.