Home >Backend Development >PHP Problem >How to solve the problem that modifying php.ini under Linux does not take effect

How to solve the problem that modifying php.ini under Linux does not take effect

藏色散人
藏色散人Original
2020-08-07 10:32:003197browse

Solution to the problem that php.ini modification does not take effect: 1. Reload the "php.ini" file; 2. Search for the modified configuration in the printed "phpinfo();"; 3. Check "php -fpm.conf" configuration file and modify it.

How to solve the problem that modifying php.ini under Linux does not take effect

# Recommended: "

PHP Video Tutorial

The main reasons why php.ini modification does not take effect are as follows:

1. After modifying the php.ini configuration file, the php.ini configuration file is not reloaded.
2. There are multiple php.ini configuration files
3. The configuration in php.ini is overwritten by the configuration in other files
Problem troubleshooting:
1. After modifying the configuration, reload php.ini file, print out
phpinfo(); Check which configuration file is read, and make sure the configuration file you modified is correct. As shown below.
How to solve the problem that modifying php.ini under Linux does not take effect2. Search for the configuration you modified in the printed
phpinfo();. Pay attention to Local Value (local variable) and Master Value (main variable). Local Value will Override the value of Master Value. Master Value is the value of your php.ini configuration item, and Local Value may be the value set in the code, as shown below, eg: ini_set('display_errors',true); ,In addition, Baidu said that the settings of php.ini can be rewritten in the Apache configuration file, which may be in conf/httpd.conf or conf.d/**.conf, usually in conf.d/php .conf, but the conf.d file is not found under Windows. There may be a conf.d file under the Linux version of apache.

How to solve the problem that modifying php.ini under Linux does not take effect
3. In the Linux environment, php-fpm has not been included in php before php5.3.3. The configuration of php is basically in php.ini, php5.3.3 and later. , in addition to configuring in php.ini, you can also configure it in php-fpm.conf, and php-fpm.conf has a higher priority than php.ini.

Check the php-fpm.conf configuration file, or whether the configuration in the php-fpm.d/.conf file covers the configuration in php.ini. The configuration example of php-fpm is as follows:
php_value[session.save_handler] = redis php_value[session.save_path] = "tcp://***.***.***.***:6379?auth=*** "

The above is the detailed content of How to solve the problem that modifying php.ini under Linux does not take effect. 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