Cookies not working like they should but they work on localhost?

You set secure to true
https://www.php.net/manual/en/function.setcookie.php

But your website is served over HTTP - so that cookie request is blocked:

(See the Restrict access to cookies section)

You need an SSL certificate:

6 Likes