How to set cookie_httponly in php

藏色散人
Release: 2023-03-03 10:24:02
Original
4498 people have browsed it

How to set httponly in php: First open the php configuration file "php.ini"; then find the "session.cookie_httponly" setting item; then press "i" to put "vi" into edit mode and change the value Set to "1"; finally restart "php-fpm".

How to set cookie_httponly in php

Recommended: "PHP Tutorial"

php.ini settings cookie_httponly

Method:

Find the path to the php configuration file through the php --ini command

# php --ini
Copy after login

How to set cookie_httponly in php

Open the php configuration file php.ini

# cd /usr/local/php7/lib
 
# vi php.ini
Copy after login

How to set cookie_httponly in php

Find the session.cookie_httponly = setting item, press i to enter vi into edit mode, and set the value to 1.

session.cookie_httponly = 1
Copy after login

How to set cookie_httponly in php

Press the Esc key and enter: wq to save and exit the vi editor.

:wq
Copy after login

How to set cookie_httponly in php

Restart php-fpm, find the php-fpm process number through ps, and then restart php-fpm

# ps -ef | grep php-fpm
# kill -USR2 查询到的进程号
Copy after login

How to set cookie_httponly in php

Through the debug mode of the chrome browser, I can see that httponly is not checked, but the cookie cannot be obtained through js. The settings have taken effect.

How to set cookie_httponly in php

Notes

In order to keep the site from stopping, please restart php-fpm smoothly.

The above is the detailed content of How to set cookie_httponly in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template