What should I do if the php verification code keeps getting wrong?

藏色散人
Release: 2023-03-08 21:40:02
Original
3526 people have browsed it

Solution to the problem that the php verification code is always wrong: 1. Modify the startup user of php-fpm and change the user and user group to apache; 2. Add time zone settings in the php code, such as "date_default_timezone_set" ('PRC');".

What should I do if the php verification code keeps getting wrong?

The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer

The PHP program prompts an error in the verification code (Enter the correct verification code)

Problem

After the new server is configured, the php website is deployed, and the website opens and displays normally

Always prompts a verification code error when the user logs in. (Enter the correct verification code)

Two reasons for analysis

1. Session problem

The verification code is not remembered in the session

This should be a permission issue with the session folder of php.

How to deal with it:

php-fpm mode

Modify the startup user of php-fpm

session folder is /var/lib/php/session

vi /etc/php-fpm.d/www.conf
Copy after login

Change the user and user group to apache

user =apache
group =apache
Copy after login

or modify the session file according to the user of php-fpm Permissions

2. Time zone setting problem

php does not set the correct time zone, resulting in abnormal time judgment

Handling method

Add in the php code Time zone setting

date_default_timezone_set(‘PRC’);
Copy after login

b. Modify php.ini to set the default time zone

date.timezone = PRC
Copy after login

[Recommended learning: PHP video tutorial]

The above is the detailed content of What should I do if the php verification code keeps getting wrong?. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!