วิธีเขียนโค้ด php ใน ไฟล์นามสกุล html How to perform PHP code in the .html file?

อยากเขียนโค้ด php ใน ไฟล์นามสกุล html
How to perform PHP code in the .html file?

=======================
สำหรับ mode_php  .htaccess

<IfModule dir_module>
DirectoryIndex index.html index.htm index.shtml index.php index.php5 index.php4 index.php3 index.phtml index.cgi index.pl
Addhandler application/x-httpd-php .php .htm .html .wml
</IfModule>

หมายเหตุ : อาจใช้งานได้กับ บางโฮสติ้ง ที่รองรับ

=======================

สำหรับ FastCGI mode

php works in FastCGI mode .htaccess

<FilesMatch "\.(html|htm)$">
AddHandler fcgid-script .php .html
FCGIWrapper "/usr/local/safe-bin/fcgid53.sh" .htm
#FCGIWrapper "/usr/local/safe-bin/fcgid53.sh" .html

</FilesMatch>

It does not work. The code is not executed. Files in the folder /usr/local/safe-bin/fcgid53.sh there.
หรือ


<FilesMatch "\.(html|htm|php)$">
Addhandler application/x-httpd-php .php .htm .html .wml
AddHandler fcgid-script .php .htm .html
FCGIWrapper "/usr/local/safe-bin/fcgid53.sh"
#FCGIWrapper "/usr/local/safe-bin/fcgid56.sh"
</FilesMatch>

=======================

สำหรับ php-fpm
ติดต่อ ไลน์ ID @hostnakhonitech

สำหรับ LiteSpeed SAPI

ติดต่อ ไลน์ ID @hostnakhonitech

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

จะทำการ block IP โดยใช้ .htaccess ได้อย่างไร

สามารถทำได้โดยระบุ IP ที่ต้องการบลอกที่ .htaccess ไฟล์ โดเยการสร้างไฟล์วางไว้ที่ public_html...

วิธีการเปลี่ยนหน้าแรกจากไฟล์ index เป็นชื่ออื่นที่ต้องการใน hosting ของเรา

ภายในไฟล์ .htacess ให้ระบุข้อมูลต่อไปนี้ครับ DirectoryIndex ชื่อไฟล1 ชื่อไฟล์2 ชื่อไฟล์3...

Leverage browser caching

Change the request headers of your resources to use caching. Optimize your caching strategy....

How to enable displaying php errors on site

To enable displaying PHP errors Open your website with file manager61 Go...

การป้องกัน Hotlink: วิธีการป้องกันไม่ให้ผู้อื่นขโมยไฟล์ของคุณ

สร้างไฟล์. htaccess ในไดเร็กทอรี public_html ของคุณโดยใช้รหัสต่อไปนี้: RewriteEngine on...