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');".
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
Change the user and user group to apache
user =apache group =apache
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’);
b. Modify php.ini to set the default time zone
date.timezone = PRC
[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!