0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

さくらサーバーのバックアップ&ステージングでもPHP includeを使えるようにする

Posted at

さくらサーバーでステージング環境を作るためには、「バックアップ&ステージング」というメニューから作成できます。
このメニューの中にある「SnapUp」というサービスを使うと、本番サーバーの状態をそのままステージングにコピーすることができます。

SnapUpはホームページを丸ごとコピーできるサービスのようで、ロリポップでも使われているようです。
https://snapup.jp/

使い方等はこちらを参照してください。
https://webst8.com/blog/sakura-staging/

本番にあるWordpressなどをそのままの状態でコピーできるのは便利かもしれません。
私がハマったのは、Phpのインクルードを使用しているHTMLの状態をこのSnapUpで作成したステージング環境で利用したいと思ったのですが、Phpが動かず、「500 Internal Server Error」になってしまいました。

「.htaccess」の記述がまずいというのはなんとなくわかったのですが、どのように記述すればよいのかわからなった状態です。またステージングを利用する事もあるので、メモを残しておこうと思います。

##本番での記述
本番は次のように「php.cgi」を参照させる形で記載しました。
これをこのままステージングに持っていくことができませんでした。

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

##ステージング(SnapUp)での記述

.htaccess
AddType application/x-httpd-php .php .html

こちらのページが参考になります。
https://oxynotes.com/?p=11278

ローカルでもこの記述でphpインクルードが使えるようになります。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?