What is the issue with setting cookies on different domains in PHP?
Setting cookies on different domains in PHP can be problematic due to the SameSite cookie attribute, which restricts cookies to be sent only to the same domain that set them by default. To solve this issue, you can set the SameSite attribute to None and also include the Secure attribute if the cookie should only be sent over HTTPS.
setcookie('cookie_name', 'cookie_value', ['samesite' => 'None', 'secure' => true]);