Recursively find and replace php.ini date.timezone

Ryan Server

I recently had to update PHP on a server and the php.ini settings but then the date.timezone wasn’t set in a bunch of servers. So I decided just to search and replace them instead of doing them all individually.

find . -name 'php.ini' -type f -exec sed -i 's/;date.timezone =/date.timezone = "America\/Toronto"/g' {} +

Note the extra \ between America/Toronto which comes from the List of Supported Timezones.