We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum
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.
Want to reply to this thread?Login with Perch