Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9120807
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:42:25+00:00 2026-06-17T05:42:25+00:00

I am using PHP setcookie to set ordinary cookies, then later setting one with

  • 0

I am using PHP setcookie to set ordinary cookies, then later setting one with httponly. It seems this does not work. The setcookie function returns success but the cookie is not set in $_COOKIE.

Is it possible to mix ordinary and httponly cookies?

UPDATE

Yes, it works.

Thanks Rudi.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:42:26+00:00Added an answer on June 17, 2026 at 5:42 am

    As noted in comments, mixing non-httponly and httponly cookies is not a problem at all if you’re reading them by PHP, because PHP obviously needs a HTTP request to be processed and so will receive the cookie as usual, regardless of it’s HttpOnly flag.

    The following test case can prove this (open, and refresh):

    <?php 
    echo '<pre>'; 
    var_dump($_COOKIE); 
    echo '</pre>'; 
    
    setcookie('TestNonHttpOnly', 'True', time() + 3600, '/', '.example.com', false, false); 
    setcookie('TestHttpOnly', 'True', time() + 3600, '/', '.example.com', false, true); 
    

    (Live test available)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm setting a cookie using this code: setcookie(Blah,user,time()+86400); i'm then checking that cookie on
I have set my cookie in PHP using the following: setcookie(id, 100, time()+100000, /AP,
I need to set cookie that expires after 1 hour using PHP setcookie function.
Using PHP I echo out table rows in a loop like this: <?php /*
Using good development practices, should one check for the existence of the setcookie after
This is the very simple code I am using to set a cookie in
I'm trying to set two cookies for the same site. (Except one is a
I am creating a cookie in CakePHP using setcookie() from /cake/contoller_name/method/parameter this page .
I know how the cookies work, just started to dig why Codeigniter does not
why can not change the cookie value using mootools? if I had set a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.