Recursively find and replace php.ini date.timezone

by | Dec 22, 2014 | Server | 0 comments

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.

Hosting Recommendation

Hostinger - The Secret Weapon of Successful Site Owners

There's a reason I recommend Hostinger. After testing dozens of hosting providers, only Hostinger delivers the perfect combination of:

🔥 Blazing-fast load times
(essential for performance)
🛡️ Rock-solid uptime
(your sites earn money 24/7)
🔒 Free SSL certificates
(builds trust instantly)
💾 Automated backups
(your business is always protected)
👨‍💻 Expert support
(problems solved in minutes, not days)
⚙️ One-click WordPress setup
(seamless integration guaranteed)
💰 Starting at just $2.99/month
(premium hosting that won't break the bank)

Use my link or referral code
MILLIONDOLLARS to get 20% off !