{"id":1615,"date":"2021-02-17T06:41:14","date_gmt":"2021-02-17T06:41:14","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/solution-failed-to-set-ini-option-session-cookie-samesite-to-value-lax-in-magento-2-3-6-p1\/"},"modified":"2025-05-22T11:02:10","modified_gmt":"2025-05-22T05:32:10","slug":"solution-failed-to-set-ini-option-session-cookie-samesite-to-value-lax-in-magento-2-3-6-p1","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/solution-failed-to-set-ini-option-session-cookie-samesite-to-value-lax-in-magento-2-3-6-p1\/","title":{"rendered":"Solved: Failed to Set ini Option \u201csession.cookie_samesite\u201d to Value \u201cLax\u201d in Magento 2.3.6-p1"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Did you try to install Magento 2.3.6-p1?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">And faced an error after installing the Magento version 2.3.6-p1 that looks something like this:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><em><strong>report.ERROR: Failed to set ini option \u201csession.cookie_samesite\u201d to value \u201cLax\u201d.<\/strong><\/em><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">If yes, relatable!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because I\u2019ve also faced the same error. To save you from all the process I went through to find the solution to&nbsp;<em><strong>Failed to Set ini Option \u201csession.cookie_samesite\u201d to Value \u201cLax\u201d in Magento 2.3.6-p1<\/strong><\/em>, I have posted it here.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This error occurs due to the lower PHP version you may be using.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution for Failed to Set ini Option \u201csession.cookie_samesite\u201d to Value \u201cLax\u201d in Magento 2.3.6-p1<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>PHP 7.3 or above<\/strong>&nbsp;version is a must to solve this error!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So check if your version of PHP is 7.3 or above. If not, set PHP 7.3 or above version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, I have another solution for this error if you don\u2019t want to change your PHP version.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the below code in your&nbsp;<strong>SessionManager.php&nbsp;<\/strong>file located at&nbsp;<strong><strong>vendor\\magento\\framework\\Session\\<\/strong><\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">private function initIniOptions()\n{\n    $result = ini_set('session.use_only_cookies', '1');\n    if ($result === false) {\n        $error = error_get_last();\n        throw new \\InvalidArgumentException(\n            sprintf('Failed to set ini option session.use_only_cookies to value 1. %s', $error['message'])\n        );\n    }\n    foreach ($this->sessionConfig->getOptions() as $option => $value) {\n        if ($option === 'session.cookie_samesite') {\n            continue;\n        }\n        if ($option == 'session.save_handler') {\n            continue;\n        } else {\n            $result = ini_set($option, $value);\n            if ($result === false) {\n                $error = error_get_last();\n                throw new \\InvalidArgumentException(\n                    sprintf('Failed to set ini option \"%s\" to value \"%s\". %s', $option, $value, $error['message'])\n                );\n            }\n        }\n    }\n}<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">However,&nbsp;<strong>it is not recommended to apply changes in the default file of Magento<\/strong>. So it is better to use PHP version 7.3 or above.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s all!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento Community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank You.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Did you try to install Magento 2.3.6-p1? And faced an error after installing the Magento version 2.3.6-p1 that looks something like this: report.ERROR: Failed to&#8230;<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1615","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1615","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1615"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1615\/revisions"}],"predecessor-version":[{"id":14488,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1615\/revisions\/14488"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1615"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1615"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1615"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}