这个 php.ini 文件到底在哪里?
我在 yahoo 上使用 phpMyAdmin 运行 php 与 4.1.14。 它说该文件位于 /usr/lib/php/php4.ini 但我在任何地方都找不到它。 它在 phpMyAdmin 文件夹中吗?我真的需要尽快找到这个并关闭 magic_quotes,否则我就要去邮寄了。谢谢。
好吧,我想这还不是很清楚。我做了 phpinfo()。我不知道如何在服务器上找到该位置......
I'm running php vs. 4.1.14 on yahoo with phpMyAdmin.
it says the file is at /usr/lib/php/php4.ini but I can't find this anywhere.
Is it in the phpMyAdmin folder? I really need to find this and turn of magic_quotes soon or I'm gonna go postal. Thanks.
Okay So i guess It wasn't that clear. I did phpinfo(). I don't know how to find that location on the server.....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
执行
phpinfo()
:它将告诉您所使用的 php.ini 的确切完整位置。您不应该再使用 PHP 4。 :)
Do a
phpinfo()
: It will tell you the exact full location of the php.ini used.You should not be using PHP 4 any more. :)
在专用服务器上查找 php.ini 可以通过 phpinfo 轻松完成(正如其他人所说)
但我认为您正在使用共享托管环境(因此您无法编辑 php.ini)并且实际上需要关闭
magic_quotes_gpc
。 (我说得对吗?)如果是这样,只需在 Web 根目录(或 phpMyAdmin 根目录)中创建一个名为
.htaccess
的文件,并将以下行放入其中。希望能有所帮助:-)
Finding php.ini on a dedicated server can be done easily by
phpinfo
(as others said)But I think you're using a shared hosting environment (so you can not edit php.ini) and actually need to turn off
magic_quotes_gpc
. (Am I right?)If so, simply create a file named
.htaccess
in the web root (or phpMyAdmin root) and put the following line in that.Hope to help :-)
您不必关闭魔术引号,只需将其粘贴在每个页面的顶部:
如果魔术引号被禁用,它将不会执行任何操作。如果启用,它将循环遍历 POST 字段,从每个条目中删除斜杠。
You don't have to turn off magic quotes, just stick this at the top of every page:
It will do nothing if magic quotes is disabled. If it is enabled, it will loop throught the POST fields, stripping slashes from each entry.
您在 phpinfo 中找到的路径
是您的托管帐户服务器上的路径。路径开头的正斜杠表示它是来自文件系统根级别的路径。可以将其想象为 Windows 计算机上的
C:\
文件夹。如果您可以通过 SSH 访问服务器,则可以使用命令行编辑器编辑此文件(“pico”是最容易学习的)
如果您使用 sFTP 客户端,则应该有一个命令(可能是一个按钮或一个下拉菜单) )类似于“转到文件夹”或“转到目录”。这应该允许您输入路径,
该路径会将您放入包含 php.ini 的文件夹中。
同样通过 sFTP,登录时您应该会看到“..”文件夹。单击此按钮会将您从主目录向上移动一个目录。继续单击此按钮,直到到达顶部,然后深入查看
如果您通过某种文件共享访问此内容,那么您就不走运了。您的系统管理员已有效地将您拒之门外。此外,如果服务器管理员阻止了对这些文件夹和文件的访问(在共享托管环境中通常是常见且必需的),则上述技术可能不起作用
The path you found in phpinfo
is path on the server of your hosting account. The forward slash at the beginning of the path indicates it's a path from the root level of the file system. Think of this like the
C:\
folder on a windows machine.If you have SSH access to the server you can edit this file with a command line editor ("pico" is the easiest to learn)
If you're using an sFTP client you should have a command (possibly a button or a drop down menu) that is something like "Go to Folder" or "Go to Directory". This should allow you to enter the path
which will drop you in the folder with php.ini.
Also via sFTP, when you log in you should see the ".." folder. Clicking on this will move you up a directory from your home directory. Keep click on this until you get to the top, then drill down to
If you're accessing this through a file share of some kind, you're out of luck. Your system admin has effectively locked you out. Also, the above techniques may not work if the administrator of the server has blocked access to these folders and files (often common and necessary in a shared hosting environment)
如果您使用以下命令创建新的 PHP 文件:
那么它将显示加载了哪个 php.ini 文件
If you create a new PHP file with:
Then it will show you which php.ini file is loaded