{"0":"Warning: ini_set(): A session is active. You cannot change the session module's ini settings at this time in \/www\/wwwroot\/html\/www.******.com\/vendor\/magento\/framework\/Session\/SessionManager.php on line 129","1":"#0 [internal function]: Magento\\Framework\\App\\ErrorHandler->handler(2, 'ini_set(): A se...',
此日志出现在report目录下,必须得修复。
1。进入数据库,core_config_data 表移除其中关于cookie及session的项,不用担心,如果删除错误,会自动调用默认的配置参数。
2.打开文件
/vendor/magento/framework/Session/SessionManager.php
部分版本报错的文件是
lib/internal/Magento/Framework/Session/SessionManager.php
具体依据您自己出错的日志来判断。
找到
// Enable session.use_only_cookies
ini_set('session.use_only_cookies', '1');修改为
if (!$this->isSessionExists()) {
ini_set('session.use_only_cookies', '1');
}找到
/**
* Performs ini_set for all of the config options so they can be read by session_start
*
* @return void
*/
private function initIniOptions()
{
foreach ($this->sessionConfig->getOptions() as $option => $value) {
$result = ini_set($option, $value);
if ($result === false) {
$error = error_get_last();
throw new \InvalidArgumentException(
sprintf('Failed to set ini option "%s" to value "%s". %s', $option, $value, $error['message'])
);
}
}
}修改为
/**
* Performs ini_set for all of the config options so they can be read by session_start
*
* @return void
*/
private function initIniOptions()
{
foreach ($this->sessionConfig->getOptions() as $option => $value) {
if ($option=='session.save_handler') { continue; } else {
$result = ini_set($option, $value); }
if ($result === false) {
$error = error_get_last();
throw new \InvalidArgumentException(
sprintf('Failed to set ini option "%s" to value "%s". %s', $option, $value, $error['message'])
);
}
}
}一般出现上述问题的原因就是切换了PHP版本或是无意composer升级了部分组件。可以配置composer的本地hosts禁止自动升级。




