1
1

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 5 years have passed since last update.

さくらのレンタルサーバーでPHPが表示されない時の対処方法

Posted at

こんにちは。

今回は、さくらのレンタルサーバーでPHPが表示されない時の対処方法を簡単に書きたいと思います。
まず、PHPファイルを作成する時は"ファイル名.php"の様に作成すると思います。

しかし、これをさくらのレンタルサーバーにそのままデプロイするとブラウザが真っ白の状態になって表示されません。
もしくは、ブラウザにPHPのソースコードが表示されるだけになってしまいます。

そこで、さくらのレンタルサーバーで、PHPファイルを最初にデプロイする時は
まず、ファイルマネージャーにアクセスしてホームディレクトリ("/home/ドメイン名/www/ココ")にアクセスして
htaccessファイルを右クリックして編集します。htaccessファイルを開いたら

  • AddType application/x-httpd-php .php

と記述します。

これで、さくらのレンタルサーバーでPHPファイルが使用出来る様になりました。

また、WordPressも同じ様に
WordPressのホームディレクトリで、htaccessファイルがありますので
開いて同じ様に記述すると、WordPress内でも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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?