{"id":269,"date":"2025-05-20T11:10:52","date_gmt":"2025-05-20T11:10:52","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=269"},"modified":"2025-05-22T07:47:11","modified_gmt":"2025-05-22T07:47:11","slug":"set-timezone-docker-php-5-6-centos9","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2025\/05\/20\/set-timezone-docker-php-5-6-centos9\/","title":{"rendered":"\u0e27\u0e34\u0e18\u0e35\u0e15\u0e31\u0e49\u0e07 timezone \u0e43\u0e2b\u0e49\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07 Docker PHP 5.6 \u0e1a\u0e19 CentOS9"},"content":{"rendered":"\n<p><u><strong>\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48 1 \u0e41\u0e01\u0e49 <code>php.ini<\/code> \u0e08\u0e32\u0e01\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 Host<\/strong><\/u><\/p>\n\n\n\n<p>1. \u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c <code>php.ini<\/code> \u0e1a\u0e19\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 host (\u0e14\u0e49\u0e32\u0e19\u0e19\u0e2d\u0e01 container):<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir -p \/opt\/php56\nnano \/opt\/php56\/php.ini\n<\/pre><\/div>\n\n\n<p>\u0e40\u0e1e\u0e34\u0e48\u0e21\u0e40\u0e19\u0e37\u0e49\u0e2d\u0e2b\u0e32\u0e40\u0e0a\u0e48\u0e19:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndate.timezone = Asia\/Bangkok\n<\/pre><\/div>\n\n\n<p>2. \u0e41\u0e01\u0e49\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07 <code>docker run<\/code> \u0e43\u0e2b\u0e49 mount \u0e44\u0e1f\u0e25\u0e4c\u0e19\u0e35\u0e49\u0e40\u0e02\u0e49\u0e32\u0e44\u0e1b\u0e43\u0e19 container:<\/p>\n\n\n\n<p>\u0e2b\u0e22\u0e38\u0e14 container \u0e40\u0e01\u0e48\u0e32:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker stop php56-fpm\ndocker rm php56-fpm\n<\/pre><\/div>\n\n\n<p>\u0e23\u0e31\u0e19\u0e43\u0e2b\u0e21\u0e48\u0e42\u0e14\u0e22 mount <code>php.ini<\/code>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\ndocker run -d \\\n  --name php56-fpm \\\n  -p 9006:9000 \\\n  -v \/var\/www\/html\/old-chaiyakul.com:\/var\/www\/html\/old-chaiyakul.com \\\n  -v \/opt\/php56\/php.ini:\/usr\/local\/etc\/php\/php.ini \\\n  --privileged \\\n  --restart unless-stopped \\\n  php:5.6-fpm\n<\/pre><\/div>\n\n\n<p><strong>**\u0e2b\u0e32\u0e01\u0e2b\u0e25\u0e31\u0e07 reboot \u0e40\u0e01\u0e34\u0e14 503 Service Unavailable<\/strong><\/p>\n\n\n\n<p>\u0e1b\u0e31\u0e0d\u0e2b\u0e32 <strong>503 Service Unavailable \u0e2b\u0e25\u0e31\u0e07 reboot<\/strong> \u0e40\u0e01\u0e34\u0e14\u0e08\u0e32\u0e01 Apache \u0e1e\u0e22\u0e32\u0e22\u0e32\u0e21\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e15\u0e48\u0e2d\u0e01\u0e31\u0e1a PHP-FPM \u0e17\u0e35\u0e48\u0e23\u0e31\u0e19\u0e2d\u0e22\u0e39\u0e48\u0e43\u0e19 Docker container \u0e1c\u0e48\u0e32\u0e19 <code>proxy:fcgi:\/\/127.0.0.1:9006<\/code> <strong>\u0e41\u0e15\u0e48 container \u0e22\u0e31\u0e07\u0e44\u0e21\u0e48\u0e23\u0e31\u0e19 \u0e2b\u0e23\u0e37\u0e2d\u0e23\u0e31\u0e19\u0e44\u0e21\u0e48\u0e17\u0e31\u0e19<\/strong> \u0e17\u0e33\u0e43\u0e2b\u0e49 Apache \u0e44\u0e21\u0e48\u0e40\u0e08\u0e2d PHP-FPM \u0e08\u0e36\u0e07\u0e41\u0e2a\u0e14\u0e07 503<\/p>\n\n\n\n<p>\u0e27\u0e34\u0e18\u0e35\u0e41\u0e01\u0e49: \u0e17\u0e33\u0e43\u0e2b\u0e49 Docker container <code>php56-fpm<\/code> \u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot<\/p>\n\n\n\n<p>1.\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32 container \u0e16\u0e39\u0e01\u0e15\u0e31\u0e49\u0e07\u0e43\u0e2b\u0e49 restart \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e23\u0e37\u0e2d\u0e44\u0e21\u0e48:<\/p>\n\n\n\n<p>\u0e23\u0e31\u0e19\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e19\u0e35\u0e49:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\ndocker inspect -f &#039;{{ .HostConfig.RestartPolicy.Name }}&#039; php56-fpm\n<\/pre><\/div>\n\n\n<p>\u0e16\u0e49\u0e32\u0e44\u0e14\u0e49\u0e1c\u0e25\u0e25\u0e31\u0e1e\u0e18\u0e4c\u0e40\u0e1b\u0e47\u0e19 <code>no<\/code> \u0e2b\u0e23\u0e37\u0e2d\u0e27\u0e48\u0e32\u0e07\u0e40\u0e1b\u0e25\u0e48\u0e32 \u0e41\u0e2a\u0e14\u0e07\u0e27\u0e48\u0e32\u0e22\u0e31\u0e07 <strong>\u0e44\u0e21\u0e48\u0e15\u0e31\u0e49\u0e07\u0e43\u0e2b\u0e49 restart<\/strong><\/p>\n\n\n\n<p>2.\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32\u0e43\u0e2b\u0e49 container \u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot:<\/p>\n\n\n\n<p>\u0e23\u0e31\u0e19\u0e04\u0e33\u0e2a\u0e31\u0e48\u0e07\u0e19\u0e35\u0e49:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\ndocker update --restart unless-stopped php56-fpm\n<\/pre><\/div>\n\n\n<p>\u0e15\u0e31\u0e27\u0e40\u0e25\u0e37\u0e2d\u0e01 <code>unless-stopped<\/code> \u0e04\u0e37\u0e2d:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0e08\u0e30\u0e40\u0e23\u0e34\u0e48\u0e21 container \u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot<\/li>\n\n\n\n<li>\u0e22\u0e01\u0e40\u0e27\u0e49\u0e19\u0e04\u0e38\u0e13\u0e2b\u0e22\u0e38\u0e14\u0e21\u0e31\u0e19\u0e14\u0e49\u0e27\u0e22 <code>docker stop<\/code> \u0e40\u0e2d\u0e07<\/li>\n<\/ul>\n\n\n\n<p>3. reboot<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nreboot\n<\/pre><\/div>\n\n\n<p><u><strong>\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48 2 (\u0e0a\u0e31\u0e48\u0e27\u0e04\u0e23\u0e32\u0e27): \u0e15\u0e31\u0e49\u0e07\u0e43\u0e19\u0e44\u0e1f\u0e25\u0e4c PHP \u0e14\u0e49\u0e27\u0e22 <code>date_default_timezone_set()<\/code><\/strong><\/u><\/p>\n\n\n\n<p>\u0e43\u0e19 <code>index.php<\/code>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&lt;?php\ndate_default_timezone_set(&quot;Asia\/Bangkok&quot;);\nphpinfo();\n<\/pre><\/div>\n\n\n<p>\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a\u0e27\u0e48\u0e32 timezone \u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07<\/p>\n\n\n\n<p>\u0e42\u0e2b\u0e25\u0e14\u0e40\u0e27\u0e47\u0e1a\u0e2d\u0e35\u0e01\u0e04\u0e23\u0e31\u0e49\u0e07 \u0e41\u0e25\u0e49\u0e27\u0e14\u0e39\u0e43\u0e19\u0e2b\u0e19\u0e49\u0e32 <code>phpinfo()<\/code> \u0e15\u0e23\u0e07\u0e2b\u0e31\u0e27\u0e02\u0e49\u0e2d <code>date<\/code> \u2192 <code>Default timezone<\/code><br>\u0e04\u0e27\u0e23\u0e40\u0e2b\u0e47\u0e19\u0e27\u0e48\u0e32\u0e40\u0e1b\u0e47\u0e19 <code>Asia\/Bangkok<\/code><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e27\u0e34\u0e18\u0e35\u0e17\u0e35\u0e48 1 \u0e41\u0e01\u0e49 php.ini \u0e08\u0e32\u0e01\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 Host 1. \u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c php. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","footnotes":""},"categories":[105,9],"tags":[],"class_list":["post-269","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/comments?post=269"}],"version-history":[{"count":5,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/269\/revisions"}],"predecessor-version":[{"id":288,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/269\/revisions\/288"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}