When I try to access the page showing an error in Magento latest upgrade

ValueError: setcookie(): "path" option cannot contain ",", ";", " ", "\t", "\r", "\n", "\013", or "\014" in /var/www/html/gossip/vendor/magento/framework/Stdlib/Cookie/PhpCookieManager.php:152 Stack trace:

1 Answer 1


The setcookie() function in PHP is used to send a cookie to the client's browser. It can take several parameters, one of which is the path parameter, which specifies the path on the server in which the cookie will be available.

The error message you provided suggests that the path parameter you passed to setcookie() contains one or more of the following characters: ,, ;, (space), \t (tab), \r (carriage return), \n (newline), \013 (vertical tab), or \014 (form feed). These characters are not allowed in the path parameter because they can be used to inject additional cookies or other malicious data.

To fix the error, you should remove any of these disallowed characters from the path parameter that you pass to setcookie(). Make sure that the path parameter only contains valid characters for a file path on your server.

For example, instead of:

setcookie('mycookie', 'myvalue', time() + 3600, '/path/to/my/dir,/another/dir');

You could use:

setcookie('mycookie', 'myvalue', time() + 3600, '/path/to/my/dir/another/dir');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.