编程语言
首页 > 编程语言> > php – 如何让我的会话写入apache

php – 如何让我的会话写入apache

作者:互联网

我最近切换了服务器,现在我的主页无法正常工作.它给出了以下文字:

Warning: session_start() [function.session-start]: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, O_RDWR) failed: Permission denied (13) in /var/www/vhosts/alt.alternativedc.com/httpdocs/index.php on line 6

Warning: Unknown: open(/var/lib/php/session/sess_eqbchncji8kj22f0iqa9g3v7u2, O_RDWR) failed: Permission denied (13) in Unknown on line 0

Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0

我认为这意味着会话文件夹不可写,因此我在ssh-ed进入服务器后运行以下命令:

chmod o+rw /var/lib/php/session

这似乎没有解决问题.不知道现在该怎么办……

解决方法:

尝试在php配置文件中更改会话保存路径,/ tmp是个好位置.

php.ini中

session.save_path = /tmp

http://www.php.net/manual/en/session.configuration.php#ini.session.save-path

标签:php,apache,session-variables
来源: https://codeday.me/bug/20191004/1854440.html