这个 php.ini 文件到底在哪里?

发布于 2024-09-13 02:53:04 字数 212 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

野稚 2024-09-20 02:53:04
  1. 执行 phpinfo():它将告诉您所使用的 php.ini 的确切完整位置。

  2. 您不应该再使用 PHP 4。 :)

  1. Do a phpinfo(): It will tell you the exact full location of the php.ini used.

  2. You should not be using PHP 4 any more. :)

淡笑忘祈一世凡恋 2024-09-20 02:53:04

在专用服务器上查找 php.ini 可以通过 phpinfo 轻松完成(正如其他人所说)

但我认为您正在使用共享托管环境(因此您无法编辑 php.ini)并且实际上需要关闭magic_quotes_gpc。 (我说得对吗?)
如果是这样,只需在 Web 根目录(或 phpMyAdmin 根目录)中创建一个名为 .htaccess 的文件,并将以下行放入其中。

php_flag magic_quotes_gpc off  

希望能有所帮助:-)

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.

php_flag magic_quotes_gpc off  

Hope to help :-)

抹茶夏天i‖ 2024-09-20 02:53:04

您不必关闭魔术引号,只需将其粘贴在每个页面的顶部:

function FixMagicQuotes()
{
    if(get_magic_quotes_gpc())
    {
        foreach($_POST as $key => $value)
        {
            $_POST[$key] = stripslashes($_POST[$key]);
        }
    }
}

FixMagicQuotes();

如果魔术引号被禁用,它将不会执行任何操作。如果启用,它将循环遍历 POST 字段,从每个条目中删除斜杠。

You don't have to turn off magic quotes, just stick this at the top of every page:

function FixMagicQuotes()
{
    if(get_magic_quotes_gpc())
    {
        foreach($_POST as $key => $value)
        {
            $_POST[$key] = stripslashes($_POST[$key]);
        }
    }
}

FixMagicQuotes();

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.

屌丝范 2024-09-20 02:53:04

您在 phpinfo 中找到的路径

/usr/lib/php/php4.ini

是您的托管帐户服务器上的路径。路径开头的正斜杠表示它是来自文件系统根级别的路径。可以将其想象为 Windows 计算机上的 C:\ 文件夹。

如果您可以通过 SSH 访问服务器,则可以使用命令行编辑器编辑此文件(“pico”是最容易学习的)

$ pico /usr/lib/php/php4.ini

如果您使用 sFTP 客户端,则应该有一个命令(可能是一个按钮或一个下拉菜单) )类似于“转到文件夹”或“转到目录”。这应该允许您输入路径,

/usr/lib/php/

该路径会将您放入包含 php.ini 的文件夹中。

同样通过 sFTP,登录时您应该会看到“..”文件夹。单击此按钮会将您从主目录向上移动一个目录。继续单击此按钮,直到到达顶部,然后深入查看

/usr/lib/php

如果您通过某种文件共享访问此内容,那么您就不走运了。您的系统管理员已有效地将您拒之门外。此外,如果服务器管理员阻止了对这些文件夹和文件的访问(在共享托管环境中通常是常见且必需的),则上述技术可能不起作用

The path you found in phpinfo

/usr/lib/php/php4.ini

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)

$ pico /usr/lib/php/php4.ini

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

/usr/lib/php/

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

/usr/lib/php

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)

淡淡離愁欲言轉身 2024-09-20 02:53:04

如果您使用以下命令创建新的 PHP 文件:

<?php phpinfo(); ?>

那么它将显示加载了哪个 php.ini 文件

If you create a new PHP file with:

<?php phpinfo(); ?>

Then it will show you which php.ini file is loaded

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文