如何强制重新加载 php.ini 文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27396973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to force reloading php.ini file?
提问by Fractaliste
I configured a web server last week, it worked fine.
我上周配置了一个 Web 服务器,它运行良好。
Today I request its homepage, I see a timezone error, as it should be configured into my php.ini file.
今天我请求它的主页,我看到一个时区错误,因为它应该被配置到我的 php.ini 文件中。
I try a phpinfo();
on my webserver, it gives me:
我phpinfo();
在我的网络服务器上尝试了一个,它给了我:
Configuration File (php.ini) Path /opt/rrh/php/lib
But no php.ini file loaded.
但是没有加载 php.ini 文件。
I investigate, the php file exists and has very large permissions:
我调查,php文件存在并且具有非常大的权限:
ls -la /opt/rrh/php/lib
-rwxrwxrwx 1 apache root 68448 Nov 22 10:10 php.ini
I try a parse_ini_file("/opt/rrh/php/lib/php.ini"));
, it returns no error...
我尝试了一个parse_ini_file("/opt/rrh/php/lib/php.ini"));
,它没有返回错误......
Of course I restart my server a dozen of time.
当然,我重新启动了我的服务器十几次。
What can I do more to resolve my problem?
我还能做些什么来解决我的问题?
My system:
我的系统:
- Redhat 6
- Apache 2.4
- PHP 5.5.19 with
libphp5.so
apache module
- 红帽 6
- 阿帕奇 2.4
- PHP 5.5.19 与
libphp5.so
apache 模块
回答by g_uint
To force a reload of the php.ini you should restart apache.
要强制重新加载 php.ini,您应该重新启动 apache。
Try sudo service apache2 restart
from the command line.
Or sudo /etc/init.d/apache2 restart
sudo service apache2 restart
从命令行尝试。或者sudo /etc/init.d/apache2 restart
回答by Kris Roofe
You also can use graceful restart the apache server with service apache2 reload
or apachectl -k graceful
.
As the apache docsays:
您还可以使用优美重新启动Apache服务器service apache2 reload
或apachectl -k graceful
。正如 apache文档所说:
The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they're not serving anything). The parent re-reads its configuration files and re-opens its log files. As each child dies off the parent replaces it with a child from the new generation of the configuration, which begins serving new requests immediately.
USR1 或优雅信号使父进程建议子进程在当前请求后退出(或者如果他们没有提供任何服务则立即退出)。父级重新读取其配置文件并重新打开其日志文件。当每个子节点死亡时,父节点会用新一代配置中的子节点替换它,它会立即开始处理新请求。