Set a cookie with the secure flag in PHP :-

Open php.ini file then search session.cookie_secure then replace this(;session.cookie_secure =) with session.cookie_secure = 1

Don’t forget to remember remove(;) in from of session.cookie_secure = 1

After that restart your server and check you found Secure flag

Note: If you not found secure flag then clear history or try on incognito mode

Output:-

Set a cookie with http only in PHP :-

Open php.ini file then search session.cookie_httponly then replace this(;session.cookie_httponly=) with session.cookie_httponly= 1

Don’t forget to remember remove(;) in from of session.cookie_httponly= 1

After that restart your server and check you found Secure flag

Note: If you not found secure flag then clear history or try on incognito mode

Output:-


Also read this