The PHP interpreter automatically processes files with the following extensions as PHP scripts:

  • *.php
  • *.phtml

That is, files with such extensions will be automatically processed by the web server as PHP scripts. For example, index.php or 123.phtml. The user can independently add their own extensions to process the corresponding files as PHP scripts by placing a line like this in the .htaccess file:

AddType application/x-httpd-php .ext1 .php3 .html
where ext1, php3 and .html are the extensions to be added to the file names. For example, in this case, the files index.ext1, file.php3 and test.html will be considered PHP scripts.

Adding your own PHP extension to a virtual hosting environment involves a few steps. Here’s a general guide:

Compile or Obtain the Extension:

  1. Compile from Source:
    • If you have the source code for the PHP extension, you may need to compile it. Follow the specific compilation instructions provided with the extension.
  2. Download Pre-compiled Extension:
    • Some PHP extensions may be available as pre-compiled binaries. You can download them from the official PHP PECL (PHP Extension Community Library) website or other trusted sources.