How to set PHP timezone in php.ini
- Category : PHP Configuration
- Posted on : Jun 21, 2021
- Views : 871
- By : HostSEO
You can configure PHP setting to use your local time zone by setting the date.timezone directive in php.ini.
List of available time zones can be found here.
Follow these instructions depending on the shared hosting plan you are using:
for shared servers (Stellar, Stellar Plus plans and old Value, Professional, and Ultimate plans)
for business servers (Stellar Business and old Business SSD packages)
How to change 'date.timezone' on shared servers
Â
1. Go to your cPanel account >> the Files section >> the File Manager menu:
2. Navigate to the root folder of your website (by default, it is public_html for the main domain and yourdomain.com for addon domains). If you don't have the php.ini file yet, feel free to create it using the "+ File"button:
Right-click the file and select Code Edit:
3. Add the following line:
date.timezone = "Place/Your_town"
change Place/Your_town to the preferred time zone:
4. Click Save Changes.
5. Next, add an LSPHP directive rule to your .htaccess file. You can learn more about the LSPHP handler here.
Add the following lines to the .htaccess file (.htaccess is a hidden file. To see such files, click Settings in the upper right corner of the File Manager, check Show hidden files (dotfiles), then Save):
Add the following line:
lsapi_phpini /home/cPanel_user/public_html/php.ini
Replace the cPanel_username with your actual cPanel username. If your php.ini file is located in a different directory, change the path accordingly:
6. Click Save Changes.
How to change 'date.timezone' on business servers
Before editing/creating the php.ini file on a business server, you will need to check the PHP version that is set for the domain.
1. Go to cPanel account >> the PHP Tweaks menu and select the domain from the drop-down menu. Check the PHP version used for this domain:
2. Next, go to the Files section >> the File Manager menu:
3.
Enable Show hidden files (dotfiles) in the Settings menu:
4. Navigate to /home/cPanel_user/.system-php/ini/PHP_ver/yourdomain.com (where PHP_ver is the PHP version used for the domain):
5. If the php.ini file is not present in this folder, create it by using the "+ File" button:
6. Right-click php.ini >> select Code Edit:
7. Add the following line:
Â
date.timezone = "Place/Your_town"
change Place/Your_town to the preferred time zone:
Save the changes.
That's it!
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu