where the heck is this php.ini file anyways?
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 tu开发者_运维知识库rn 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.....
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. :)
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 :-)
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.
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)
If you create a new PHP file with:
<?php phpinfo(); ?>
Then it will show you which php.ini file is loaded
精彩评论