LoginSignup
1
1

More than 5 years have passed since last update.

HTMLファイル内でPHPを動作させる(さくらサーバ)

Posted at

さくらサーバに置いたHTMLファイル内でphpを動作させる方法

さくらサーバだけ他のレンタルサーバと勝手が違ったのメモ

  • .htaccessファイルを作成
    • 以下の内容を記載してhtmlファイルがある階層に配置
    • パーミッションは705に設定

  Action myphp-script /php.cgi
  AddHandler myphp-script .php .html

  • php.cgiファイルを作成
    • 以下の内容を記載してhtmlファイルがある階層に配置

  #!/bin/sh
  exec /usr/local/bin/php-cgi

これで無事HTMLファイル内に記載してあるphpが動作しました。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1