{"id":266,"date":"2025-01-02T10:04:00","date_gmt":"2025-01-02T10:04:00","guid":{"rendered":"https:\/\/blog.chaiyakul.com\/?p=266"},"modified":"2025-05-22T06:02:11","modified_gmt":"2025-05-22T06:02:11","slug":"docker-php-5-6-fpm-centos-9","status":"publish","type":"post","link":"https:\/\/blog.chaiyakul.com\/index.php\/2025\/01\/02\/docker-php-5-6-fpm-centos-9\/","title":{"rendered":"\u0e01\u0e32\u0e23\u0e15\u0e34\u0e14\u0e15\u0e31\u0e49\u0e07 PHP5.6 \u0e43\u0e19 \u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49 Docker PHP 5.6 FPM \u0e23\u0e31\u0e19\u0e43\u0e19\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 CentOS 9 \u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e15\u0e31\u0e49\u0e07\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot"},"content":{"rendered":"\n<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07<\/p>\n\n\n\n<p>\u0e19\u0e35\u0e48\u0e04\u0e37\u0e2d\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 PHP 5.6 \u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e1a\u0e19 subdomain <code>old.chaiyakul.com<\/code> \u0e42\u0e14\u0e22\u0e43\u0e0a\u0e49 Docker PHP 5.6 FPM \u0e23\u0e31\u0e19\u0e43\u0e19\u0e40\u0e04\u0e23\u0e37\u0e48\u0e2d\u0e07 CentOS 9 \u0e1e\u0e23\u0e49\u0e2d\u0e21\u0e15\u0e31\u0e49\u0e07\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot \u0e41\u0e25\u0e30\u0e40\u0e01\u0e47\u0e1a\u0e44\u0e1f\u0e25\u0e4c\u0e40\u0e27\u0e47\u0e1a\u0e17\u0e35\u0e48<\/p>\n\n\n\n<p><code>\/var\/www\/html\/old-chaiyakul.com\/<\/code><\/p>\n\n\n\n<p><u><strong>\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32<\/strong><\/u><\/p>\n\n\n\n<p>1.\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e42\u0e1f\u0e25\u0e40\u0e14\u0e2d\u0e23\u0e4c\u0e40\u0e27\u0e47\u0e1a\u0e41\u0e25\u0e30\u0e27\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c PHP<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nmkdir -p \/var\/www\/html\/old-chaiyakul.com\n# \u0e27\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c PHP \u0e02\u0e2d\u0e07\u0e04\u0e38\u0e13\u0e44\u0e27\u0e49\u0e17\u0e35\u0e48\u0e19\u0e35\u0e48 \u0e40\u0e0a\u0e48\u0e19 index.php \u0e17\u0e35\u0e48\u0e21\u0e35 &amp;lt;?php phpinfo(); ?&gt;\n<\/pre><\/div>\n\n\n<p>2.\u0e23\u0e31\u0e19 Docker container PHP 5.6 FPM<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; 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  --restart unless-stopped \\\n  php:5.6-fpm\n<\/pre><\/div>\n\n\n<p>\u0e15\u0e31\u0e27\u0e40\u0e25\u0e37\u0e2d\u0e01 <code>--restart unless-stopped<\/code> \u0e17\u0e33\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>3.\u0e15\u0e34\u0e14\u0e15\u0e31\u0e49\u0e07 Apache \u0e41\u0e25\u0e30\u0e42\u0e21\u0e14\u0e39\u0e25\u0e17\u0e35\u0e48\u0e08\u0e33\u0e40\u0e1b\u0e47\u0e19<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo dnf install -y httpd mod_proxy mod_proxy_fcgi\nsudo systemctl enable httpd\nsudo systemctl start httpd\n<\/pre><\/div>\n\n\n<p>4. \u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c VirtualHost \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a subdomain<\/p>\n\n\n\n<p>\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c <code>\/etc\/httpd\/conf.d\/old-chaiyakul.com.conf<\/code>:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: css; title: ; notranslate\" title=\"\">\n&lt;VirtualHost *:80&gt;\n    ServerName old.chaiyakul.com\n    DocumentRoot \/var\/www\/html\/old-chaiyakul.com\n\n    &lt;Directory &quot;\/var\/www\/html\/old-chaiyakul.com&quot;&gt;\n        AllowOverride All\n        Require all granted\n    &lt;\/Directory&gt;\n\n    ProxyPassMatch ^\/(.*\\.php)$ fcgi:\/\/127.0.0.1:9006\/var\/www\/html\/old-chaiyakul.com\/$1\n\n    ErrorLog \/var\/log\/httpd\/old-chaiyakul-error.log\n    CustomLog \/var\/log\/httpd\/old-chaiyakul-access.log combined\n&lt;\/VirtualHost&gt;\n<\/pre><\/div>\n\n\n<p>5.\u0e23\u0e35\u0e2a\u0e15\u0e32\u0e23\u0e4c\u0e17 Apache<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nsudo systemctl restart httpd\n<\/pre><\/div>\n\n\n<p>6.\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 DNS<\/p>\n\n\n\n<p>\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 DNS \u0e43\u0e2b\u0e49 subdomain <code>old.chaiyakul.com<\/code> \u0e0a\u0e35\u0e49\u0e44\u0e1b\u0e17\u0e35\u0e48 IP \u0e40\u0e0b\u0e34\u0e23\u0e4c\u0e1f\u0e40\u0e27\u0e2d\u0e23\u0e4c\u0e19\u0e35\u0e49<\/p>\n\n\n\n<p>7.\u0e17\u0e14\u0e2a\u0e2d\u0e1a<\/p>\n\n\n\n<p>\u0e40\u0e1b\u0e34\u0e14\u0e40\u0e1a\u0e23\u0e32\u0e27\u0e4c\u0e40\u0e0b\u0e2d\u0e23\u0e4c\u0e40\u0e02\u0e49\u0e32 <a href=\"http:\/\/old.chaiyakul.com\">http:\/\/old.chaiyakul.com<br><\/a>\u0e16\u0e49\u0e32\u0e21\u0e35\u0e44\u0e1f\u0e25\u0e4c <code>index.php<\/code> \u0e17\u0e35\u0e48\u0e21\u0e35 <code>&lt;?php phpinfo(); ?&gt;<\/code> \u0e08\u0e30\u0e40\u0e2b\u0e47\u0e19\u0e40\u0e27\u0e2d\u0e23\u0e4c\u0e0a\u0e31\u0e19 PHP 5.6 \u0e41\u0e2a\u0e14\u0e07\u0e02\u0e36\u0e49\u0e19\u0e21\u0e32<\/p>\n\n\n\n<p>\u0e2a\u0e23\u0e38\u0e1b<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>PHP 5.6 \u0e23\u0e31\u0e19\u0e43\u0e19 Docker container \u0e1e\u0e23\u0e49\u0e2d\u0e21 <code>--restart unless-stopped<\/code> \u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e2d\u0e31\u0e15\u0e42\u0e19\u0e21\u0e31\u0e15\u0e34\u0e2b\u0e25\u0e31\u0e07 reboot<\/li>\n\n\n\n<li>Apache \u0e15\u0e31\u0e49\u0e07 VirtualHost \u0e43\u0e2b\u0e49 subdomain \u0e43\u0e0a\u0e49 DocumentRoot \u0e17\u0e35\u0e48 <code>\/var\/www\/html\/old-chaiyakul.com<\/code><\/li>\n\n\n\n<li>Apache \u0e2a\u0e31\u0e48\u0e07\u0e43\u0e2b\u0e49\u0e43\u0e0a\u0e49 PHP-FPM 5.6 \u0e1c\u0e48\u0e32\u0e19\u0e1e\u0e2d\u0e23\u0e4c\u0e15 9006 \u0e17\u0e35\u0e48\u0e40\u0e0a\u0e37\u0e48\u0e2d\u0e21\u0e01\u0e31\u0e1a Docker container<\/li>\n<\/ul>\n\n\n\n<p><u><strong>\u0e43\u0e19\u0e01\u0e23\u0e13\u0e35\u0e17\u0e35\u0e48\u0e02\u0e36\u0e49\u0e19 File not found<\/strong><\/u><\/p>\n\n\n\n<p>\u0e40\u0e1b\u0e47\u0e19 <strong>\u0e1b\u0e31\u0e0d\u0e2b\u0e32 classic<\/strong> \u0e17\u0e35\u0e48\u0e40\u0e01\u0e34\u0e14\u0e08\u0e32\u0e01 Apache \u0e2a\u0e48\u0e07 path \u0e44\u0e1b\u0e22\u0e31\u0e07 PHP-FPM (Docker) <strong>\u0e41\u0e15\u0e48 PHP-FPM \u0e2b\u0e32\u0e44\u0e1f\u0e25\u0e4c\u0e44\u0e21\u0e48\u0e40\u0e08\u0e2d<\/strong> \u0e40\u0e1e\u0e23\u0e32\u0e30\u0e21\u0e2d\u0e07 path \u0e44\u0e21\u0e48\u0e40\u0e2b\u0e21\u0e37\u0e2d\u0e19\u0e01\u0e31\u0e19<\/p>\n\n\n\n<p><u><strong>\u0e17\u0e33\u0e43\u0e2b\u0e49 Apache \u0e43\u0e0a\u0e49 path \u0e15\u0e23\u0e07\u0e01\u0e31\u0e1a\u0e43\u0e19 container<\/strong><\/u><\/p>\n\n\n\n<p>1.\u0e41\u0e01\u0e49 config \u0e02\u0e2d\u0e07 Apache:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n&lt;FilesMatch \\.php$&gt;\n    SetHandler &quot;proxy:fcgi:\/\/127.0.0.1:9006&quot;\n    ProxyFCGIBackendType GENERIC\n    ProxyFCGISetEnvIf &quot;true&quot; SCRIPT_FILENAME &quot;\/var\/www\/html%{REQUEST_URI}&quot;\n&lt;\/FilesMatch&gt;\n<\/pre><\/div>\n\n\n<p><strong>\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19<\/strong> <code>\/var\/www\/html\/old-chaiyakul.com%{REQUEST_URI}<\/code><br>\u0e40\u0e1b\u0e47\u0e19: <code>\/var\/www\/html%{REQUEST_URI}<\/code><\/p>\n\n\n\n<p>2.Restart Apache:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\nsudo systemctl restart httpd\n<\/pre><\/div>\n\n\n<p><u><strong>\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 VirtualHost \u0e41\u0e1a\u0e1a HTTPS \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Apache<\/strong><\/u><\/p>\n\n\n\n<p>\u0e01\u0e32\u0e23\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 <strong>VirtualHost \u0e41\u0e1a\u0e1a HTTPS<\/strong> \u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a Apache (\u0e40\u0e0a\u0e48\u0e19\u0e43\u0e19 CentOS 9) \u0e15\u0e49\u0e2d\u0e07\u0e21\u0e35:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Domain\/subdomain \u0e17\u0e35\u0e48\u0e0a\u0e35\u0e49\u0e21\u0e32\u0e16\u0e39\u0e01\u0e15\u0e49\u0e2d\u0e07 (\u0e40\u0e0a\u0e48\u0e19 <code>old.chaiyakul.com<\/code>)<\/li>\n\n\n\n<li>\u0e21\u0e35\u0e43\u0e1a\u0e23\u0e31\u0e1a\u0e23\u0e2d\u0e07 SSL (\u0e40\u0e0a\u0e48\u0e19\u0e08\u0e32\u0e01 Let&#8217;s Encrypt \u0e2b\u0e23\u0e37\u0e2d self-signed)<\/li>\n\n\n\n<li>\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 Apache \u0e43\u0e2b\u0e49\u0e23\u0e31\u0e1a HTTPS \u0e1c\u0e48\u0e32\u0e19\u0e1e\u0e2d\u0e23\u0e4c\u0e15 443<\/li>\n<\/ol>\n\n\n\n<p><em>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e1f\u0e25\u0e4c VirtualHost \u0e41\u0e1a\u0e1a HTTPS<\/em><\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\n&lt;VirtualHost *:443&gt;\n    ServerName old.chaiyakul.com\n\n    DocumentRoot \/var\/www\/html\/old-chaiyakul.com\n\n    &lt;Directory &quot;\/var\/www\/html\/old-chaiyakul.com&quot;&gt;\n        AllowOverride All\n        Require all granted\n    &lt;\/Directory&gt;\n\n    SSLEngine on\n    SSLCertificateFile \/etc\/pki\/tls\/certs\/ip-default.crt\n    SSLCertificateKeyFile \/etc\/pki\/tls\/private\/ip-default.key\n\n    ProxyPassMatch ^\/(.*\\.php)$ fcgi:\/\/127.0.0.1:9006\/var\/www\/html\/old-chaiyakul.com\/$1\n\n    ErrorLog \/var\/log\/httpd\/old-chaiyakul-ssl-error.log\n    CustomLog \/var\/log\/httpd\/old-chaiyakul-ssl-access.log combined\n&lt;\/VirtualHost&gt;\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>\u0e15\u0e31\u0e27\u0e2d\u0e22\u0e48\u0e32\u0e07 \u0e19\u0e35\u0e48\u0e04\u0e37\u0e2d\u0e02\u0e31\u0e49\u0e19\u0e15\u0e2d\u0e19\u0e15\u0e31\u0e49\u0e07\u0e04\u0e48\u0e32 PHP 5.6 \u0e43\u0e2b\u0e49\u0e23\u0e31\u0e19\u0e1a\u0e19 subdomai [&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-266","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\/266","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=266"}],"version-history":[{"count":6,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/266\/revisions"}],"predecessor-version":[{"id":281,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/posts\/266\/revisions\/281"}],"wp:attachment":[{"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/media?parent=266"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/categories?post=266"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chaiyakul.com\/index.php\/wp-json\/wp\/v2\/tags?post=266"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}