PHP setcookie doesnt set a Cookie [duplicate]

Problem:
I got a pretty popular Problem. I want my site to set a Cookie. (with setcookie())
The last Days it was working fine, but now the cookie doesn’t appear.
I Tried everything in the past three hours but no success.

I Tried:

  • setcookie with all parameters
  • setcookie with minimal parameters
  • different parameters
  • with and without ob_start()
  • set it before any outputs or HTML-Elements (before !doctype)
  • I checked, that it’s a document without BOM
  • different browsers
  • I took it out from any brackets
  • I Checked my Browser for Blockers

I would surrender if it wasn’t an important project for me.

My current Code:

<?php
    function generateRandomString($length = 10) 
    {
        $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
        $charactersLength = strlen($characters);
        $randomString = '';
        for ($i = 0; $i < $length; $i++)
        {
            $randomString .= $characters[rand(0, $charactersLength - 1)];
        }
        return $randomString;
    }


    $token = generateRandomString(16);

    setcookie("cookiename", $token, time()+(24*3600), '/');

?>

The lines to read the Cookie are on another site. (SAME DOMAIN, OTHER PAGE)
But there, I never manipulate or delete it.
I permanently check my Dev-Tools in the Browser but theres no Cookie.