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

  • SEARCH
  • Home
  • 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 939327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:46:20+00:00 2026-05-15T21:46:20+00:00

Looking at the php documentation on setting a cookie I see that I can

  • 0

Looking at the php documentation on setting a cookie I see that I can set an expiration date for the cookie. You can set the cookie to expire at the end of the browser session or at some time in the future but I do not see a way to set the cookie to never expire. Is this even possible and how is this accomplished?

  • 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-05-15T21:46:20+00:00Added an answer on May 15, 2026 at 9:46 pm

    All cookies expire as per the cookie specification, so this is not a PHP limitation.

    Use a far future date. For example, set a cookie that expires in ten years:

    setcookie(
      "CookieName",
      "CookieValue",
      time() + (10 * 365 * 24 * 60 * 60)
    );
    

    Note that if you set a date past 2038 in 32-bit PHP, the number will wrap around and you’ll get a cookie that expires instantly.

    Edit: As in 2023, obeying the max depends on the web browsers. As of Chrome release M104 (August 2022) cookies can no longer set an expiration date of more than 400 days in the future.

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

Sidebar

Related Questions

I'm looking at PHP date() documentation and thought that 'I' would tell me whether
I'm looking for a PHP script that can be run as a cron job
Am curently looking at the jqgrid documentation on advanced search and specifically search_adv.php file
I'm looking for a PHP library that allows me to scrap webpages and takes
I am looking for a PHP IDE to work with that contains a design
Been scouring the internet looking for documentation that gives a list of acceptable strings
I am looking for a PHP function that encodes an array of points into
First off, I'm not asking about how to generate documentation FROM PHP source. That's
I've been looking around for using FFMPEG and PHP. I've noticed you can use
What does code in PHP, such as /(?<!\..|\...|\....)([\?\!\.]+)\s(?!.\.|..\.|...\.)/u mean? I'm looking for general documentation,

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.