0
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のsessionに保存されないときの解決方法(自分の場合)

0
Last updated at Posted at 2019-11-07

はじめに

centos7・apacheでphpの開発をしているときにsessionが使えなかったので、その原因と解決方法。

原因

/var/lib/php/sessionの権限が正しくなかった。

解決方法

$chmod 777 /var/lib/php/session
とりあえず権限を全て許可する。
session.PNG

結果

・セッションに値を保存(index.php)
1.PNG
・表示するコード(session_test.php)
2.PNG
・表示された!
3.PNG

おわりに

多分apacheを操作するためのwwwっていうユーザを作ったからこのようなエラーが起きたのだと思う。

権限設定で困ったらとりあえず全て許可するという癖を直したい。

参考

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