Skip to content

Instantly share code, notes, and snippets.

@GermanAizek
Last active March 24, 2020 12:21
Show Gist options
  • Save GermanAizek/8c3b4b04468adceb21917b95c7d61791 to your computer and use it in GitHub Desktop.
Save GermanAizek/8c3b4b04468adceb21917b95c7d61791 to your computer and use it in GitHub Desktop.
Выполнение PHP кода в HTML на веб сервере c FastCGI
AddHandler fcgid-script .php .phtml .html .htm
FCGIWrapper /var/www/php-bin-php74/u0811566/php .php
FCGIWrapper /var/www/php-bin-php74/u0811566/php .phtml
FCGIWrapper /var/www/php-bin-php74/u0811566/php .html
FCGIWrapper /var/www/php-bin-php74/u0811566/php .htm
@GermanAizek
Copy link
Author

С помощью изменения файла .htaccess на данный код можно добиться выполнения PHP вставок в HTML коде.
Данные правила .htaccess работают только на веб серверах FastCGI, большинство хостингов его и использует.
Пример PHP вставок:

<!doctype html>

<html lang="en">
<head>
  <meta charset="utf-8">

  <title><?php echo 'HTML5 Sample'; ?></title>
  <meta name="description" content="HTML5 Sample Page">
  <meta name="author" content="yeshodhan.kulkarni">

  <link rel="stylesheet" href="css/master.css?v=1.0">

  <!--[if lt IE 9]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
  <![endif]-->
</head>

<body>
  <script src="js/scripts.js"></script>
</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment