Linux php.ini 不存在加载的配置文件(无)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/10711698/
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
php.ini is nonexistent Loaded Configuration File (none)
提问by jstrieb
I have compiled php and apache successfully, without specifying the directory for the php config file. I want to add pear features, but there doesn't appear to be a php.ini anywhere.
In my phpinfo, it says
我已经成功编译了 php 和 apache,没有指定 php 配置文件的目录。我想添加梨形功能,但似乎没有任何地方有 php.ini。
在我的 phpinfo 中,它说
Configuration File (php.ini) Path /usr/local/apache2/php/lib
Loaded Configuration File (none)
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
配置文件 (php.ini) 路径 /usr/local/apache2/php/lib
加载的配置文件 (none)
扫描此目录以获取其他 .ini 文件 (none)
解析的其他 .ini 文件 (none)
I went to the /usr/local/apache2/php/lib directory, and there was, indeed nothing there. I also searched for php.ini, and didn't get any results whatsoever. I need to change things in php.ini, and I don't know how php is even working without one. I am just wondering whether I need to recompile php with a config directory, and how to find/acquire a php.ini so that I can fix some things.
我去了 /usr/local/apache2/php/lib 目录,那里确实什么都没有。我还搜索了 php.ini,但没有得到任何结果。我需要更改 php.ini 中的内容,我不知道 php 没有它是如何工作的。我只是想知道是否需要使用 config 目录重新编译 php,以及如何查找/获取 php.ini 以便我可以修复一些问题。
采纳答案by inigomedina
You have to copy the file php.ini-dist
from PHP source. Standard way is copying such file to /usr/local/lib/php.ini
.
您必须php.ini-dist
从 PHP 源中复制该文件。标准方法是将此类文件复制到/usr/local/lib/php.ini
.
回答by Adam Fili
The problem is that you compiled php without the --with-config-file-path=PATH option.
问题是您在没有 --with-config-file-path=PATH 选项的情况下编译了 php。
Try to reconfigure php using this option. Then run "make clean", "make" and "make install" again in this order. You must run "make clean" for this to work.
尝试使用此选项重新配置 php。然后按此顺序再次运行“make clean”、“make”和“make install”。您必须运行“make clean”才能使其工作。
回答by ColinWa
ini
file must end with .ini
and not php.ini-dist
. Remove the -dist
as it looks like a notepad file (in Windows) and cannot be read by the system.
Restart Apache and check you phpinfo() output.
ini
文件必须以.ini
而不是结尾php.ini-dist
。删除-dist
它,因为它看起来像一个记事本文件(在 Windows 中)并且系统无法读取。重新启动 Apache 并检查 phpinfo() 输出。
回答by Yuseferi
first check is there /etc/php.ini
exists , if no try to copy it
首先检查是否/etc/php.ini
存在,如果没有尝试复制它
sudo cp /etc/php.ini.default /etc/php.ini
else
别的
sudo cp /etc/php.ini.default /usr/local/lib/php.ini
then reload the webserver and try to see result with
然后重新加载网络服务器并尝试查看结果
php --ini