{"id":3005,"date":"2017-01-14T08:15:32","date_gmt":"2017-01-14T08:15:32","guid":{"rendered":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?p=3005"},"modified":"2023-02-11T11:06:51","modified_gmt":"2023-02-11T11:06:51","slug":"set-timezone-php-php-ini-file","status":"publish","type":"post","link":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/","title":{"rendered":"How to set the Timezone for PHP in the php.ini file"},"content":{"rendered":"<p>If the correct time is not displaying in your PHP scripts, you will need to make some changes on your hosting server. This can be easily done by adding a line of code to your php.ini file.<\/p>\n<p><strong>So let\u2019s see how to set the Timezone for PHP:<\/strong><\/p>\n<p><strong>Step 1:<\/strong> Open your php.ini file with the File Manager in cPanel<\/p>\n<p><strong>Step 2:<\/strong> Add the below-mentioned line of code to top of your php.ini file<\/p>\n<pre class=\"plain:false plain-toggle:false copy:false popup:false lang:default decode:true\">date.timezone = \"US\/Central\"<\/pre>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3006\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\" alt=\"\" width=\"696\" height=\"417\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg 696w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini-300x180.jpg 300w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\" \/><\/a><\/p>\n<p><strong>Step 3:<\/strong> Replace &#8220;<em>US\/Central<\/em>&#8221; with the timezone <a href=\"http:\/\/www.php.net\/manual\/en\/timezones.php\" target=\"_blank\" rel=\"nofollow noopener\">from here<\/a> that corresponds to the time you want to display.<\/p>\n<p><strong>Step 4:<\/strong> Once you have entered the timezone you want to set, click the Save Changes button to save the file.<\/p>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_1.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3007\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_1.jpg\" alt=\"\" width=\"677\" height=\"191\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_1.jpg 677w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_1-300x85.jpg 300w\" sizes=\"auto, (max-width: 677px) 100vw, 677px\" \/><\/a><\/p>\n<p><strong>Step 5:<\/strong> Now, you can check your phpinfo.php page to verify the change took place.<\/p>\n<h3>Before:<\/h3>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3008\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_2.jpg\" alt=\"\" width=\"631\" height=\"298\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_2.jpg 631w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_2-300x142.jpg 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/a><\/p>\n<h3>After:<\/h3>\n<p><a href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_3.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-3009\" src=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_3.jpg\" alt=\"\" width=\"621\" height=\"298\" srcset=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_3.jpg 621w, https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini_3-300x144.jpg 300w\" sizes=\"auto, (max-width: 621px) 100vw, 621px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>If the correct time is not displaying in your PHP scripts, you will need to make some changes on your hosting server. This can be easily done by adding a line of code to your php.ini file. So let\u2019s see how to set the Timezone for PHP: Step 1: Open your php.ini file with the [&hellip;]<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[],"class_list":["post-3005","post","type-post","status-publish","format-standard","placeholder-for-hentry","category-howtos"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to set the Timezone for PHP in the php.ini file<\/title>\n<meta name=\"description\" content=\"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to set the Timezone for PHP in the php.ini file\" \/>\n<meta property=\"og:description\" content=\"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Hosting FAQs by MilesWeb\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-14T08:15:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-11T11:06:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\" \/>\n<meta name=\"author\" content=\"Pravin Ganore\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pravin Ganore\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/\",\"name\":\"How to set the Timezone for PHP in the php.ini file\",\"isPartOf\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\",\"datePublished\":\"2017-01-14T08:15:32+00:00\",\"dateModified\":\"2023-02-11T11:06:51+00:00\",\"author\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/9f6aad74f4af57132ba60117b4ab3ea6\"},\"description\":\"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\",\"contentUrl\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg\",\"width\":696,\"height\":417},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to set the Timezone for PHP in the php.ini file\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/\",\"name\":\"Web Hosting FAQs by MilesWeb\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/9f6aad74f4af57132ba60117b4ab3ea6\",\"name\":\"Pravin Ganore\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0cc3f850bd88b8c03fef8afc4399e314?s=96&d=blank&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0cc3f850bd88b8c03fef8afc4399e314?s=96&d=blank&r=g\",\"caption\":\"Pravin Ganore\"},\"description\":\"Pravin is Journalist Specializing in Blogging, Social Networking and Community Management. As a constant learner, he is always aiming towards new ideas and greater knowledge. When he is not doing research, reading, or writing for blogs, you can find him hanging around social media sites.\",\"url\":\"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pravin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to set the Timezone for PHP in the php.ini file","description":"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/","og_locale":"en_GB","og_type":"article","og_title":"How to set the Timezone for PHP in the php.ini file","og_description":"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.","og_url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/","og_site_name":"Web Hosting FAQs by MilesWeb","article_published_time":"2017-01-14T08:15:32+00:00","article_modified_time":"2023-02-11T11:06:51+00:00","og_image":[{"url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg","type":"","width":"","height":""}],"author":"Pravin Ganore","twitter_misc":{"Written by":"Pravin Ganore","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/","name":"How to set the Timezone for PHP in the php.ini file","isPartOf":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage"},"image":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage"},"thumbnailUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg","datePublished":"2017-01-14T08:15:32+00:00","dateModified":"2023-02-11T11:06:51+00:00","author":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/9f6aad74f4af57132ba60117b4ab3ea6"},"description":"Your hosting server needs to be updated if the correct time is not displaying in your PHP scripts.","breadcrumb":{"@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#primaryimage","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg","contentUrl":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-content\/uploads\/2017\/01\/timezone_phpini.jpg","width":696,"height":417},{"@type":"BreadcrumbList","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/set-timezone-php-php-ini-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/"},{"@type":"ListItem","position":2,"name":"How to set the Timezone for PHP in the php.ini file"}]},{"@type":"WebSite","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#website","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/","name":"Web Hosting FAQs by MilesWeb","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/9f6aad74f4af57132ba60117b4ab3ea6","name":"Pravin Ganore","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0cc3f850bd88b8c03fef8afc4399e314?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0cc3f850bd88b8c03fef8afc4399e314?s=96&d=blank&r=g","caption":"Pravin Ganore"},"description":"Pravin is Journalist Specializing in Blogging, Social Networking and Community Management. As a constant learner, he is always aiming towards new ideas and greater knowledge. When he is not doing research, reading, or writing for blogs, you can find him hanging around social media sites.","url":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/author\/pravin\/"}]}},"views":2371,"_links":{"self":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/3005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/comments?post=3005"}],"version-history":[{"count":3,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/3005\/revisions"}],"predecessor-version":[{"id":13909,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/posts\/3005\/revisions\/13909"}],"wp:attachment":[{"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/media?parent=3005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/categories?post=3005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.milesweb.co.uk\/hosting-faqs\/wp-json\/wp\/v2\/tags?post=3005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}