search
HomeBackend DevelopmentPHP ProblemHow to set cookie_httponly in php

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

How to set cookie_httponly in php

Open the php configuration file php.ini

# cd /usr/local/php7/lib
 
# vi php.ini

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

How to set cookie_httponly in php

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

:wq

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 查询到的进程号

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.