I have some web applications running on PHP 7.4.26 on a Windows server. This year (2023) the Mexican government decided to stop using Daylight Saving Time (DST), which caused me problems. My web application requires the America/Mexico_City time zone, but PHP continues to use DST, adding unwanted extra time. I was able to change the Windows server time to ignore DST. Therefore, the server has the appropriate time. But PHP always gives wrong results. I cannot modify the server to reduce it by one hour (as a workaround) since it is used for other non-PHP applications. How do I force PHP to ignore DST so I can continue to use the correct time zone? Thank you so much.
Unfortunately, you will not be able to change the time zone DST without upgrading to PHP 8.
PHP contains theIANA time zone databaseandis regularly updated with newer versions of PHP.
As you can see on the IANA mailing list,Mexico did not add the change to eliminate daylight saving time until the 2022e release in October 2022.
Asthis 3v4l shows, there is no version of PHP 7 bundled with the timezone database that contains the following changes for Mexico. The minimum version you need is 8.0.26, 8.1.13, or 8.2. Since PHP 7 has been discontinued and is no longer receiving any updates, now is a good time to upgrade.