Setting cookies when Perch is included
I've never used cookies before so this could simply be a beginner misunderstanding…
In trying to create an extremely basic test case I've discovered that as soon as I include Perch I cannot set cookies.
For example, if I have a page called
index.php which comprises of this:
<?php setcookie('username', 'alex', time()+600); echo $_COOKIE['username']; ?>
A cookie of "username: alex" is successfully created. If I delete the cookie then include Perch like this:
<?php if (!defined('PERCH_RUNWAY')) include($_SERVER['DOCUMENT_ROOT'].'/perch/runtime.php');?> <?php setcookie('username', 'alex', time()+600); echo $_COOKIE['username']; ?>
The cookie fails to set.
Is there something I need to do differently when setting cookies while Perch is running on the page? I couldn't find any mention of cookies in the documentation.