Running PHP embedded in HTML files on XServer rental servers.

The .htaccess was edited because it was hosted on an XServer rental server and the PHP embedded in the HTML files needed to run.

目次

What is XServer?

XServer is known as a high-performance and stable rental server and is used by many Japanese users; it is also used to run WordPress and has many useful features such as easy installation.

In this case, when PHP was incorporated into an HTML file, PHP was not executed even if it was written in an .html file with a .html extension. Therefore, for PHP to run correctly, the .htaccess must be edited.

Edit .htaccess to allow PHP to run

Access the XServer server panel.
Click on ‘Edit .htaccess’ and add the following.

This will allow PHP to run as an HTML file on the XServer rental server.

AddHandler fcgid-script .html

This is a configuration directive used by the Apache web server that instructs a particular handler (here fcgid-script) to process files with a particular extension (here .html).

AddHandler Directive

Apache’s AddHandler is a directive for associating specific processing with a given file extension. This allows the server to determine how to process files with that extension.

fcgid-script

Handler for scripts that use FastCGI (Fast Common Gateway Interface) FastCGI is a mechanism to speed up the execution of CGI scripts and is used to efficiently process scripts such as PHP.

よかったらシェアしてね!
目次