How to change magic_quotes_off in PHP?

Hi,

I am new in PHP but I read in many pages that is a recommendation to turn off this setting, and my actual phpinfo() says that it is ON.

How i can change to OFF? What is a .htaccess file? How I can change this setting?

I read in php manuals and many links, but I don't understand nothing! Any simple form?
LVL 1
joyacv2Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
It is in 'php.ini' http://us2.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc .  It can also be set in '.htaccess' if you are running under Apache.  It can not be changed by your code because it is a value that needs to be known before your page is run.

'.htaccess' is a file that can be used with an Apache web server to set some directives in the directories where they need to be used instead of in the master file for all directories.
0
joyacv2Author Commented:
Sorry,

But I don't understand the link, how i can access the .htaccess file and change the setting?

The link says: "f the magic_quotes_sybase directive is also ON it will completely override magic_quotes_gpc", what exactly this means? Is correct for Off too?
0
Dave BaldwinFixer of ProblemsCommented:
The page on PHP.net tells you what it means.  The first thing to know is that it is not something critical.  About half of my web sites have it on and half have it off and I can still run the same programs on them.  It will not stop you from running PHP programs.

Where is your web site?  Are you on an Apache web server?  Shared hosting?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

joyacv2Author Commented:
Local Apache web server
0
Ray PaseurCommented:
In my installations of PHP I can make my own .htaccess files and my own PHP.INI files, so I turn off the things I do not want.  And I'm with DaveBaldwin on this issue - you need to write code that can tolerate either condition.  So in the initialization of all my pages, I have something like this to remove the adverse effects of magic_quotes.

foreach ($_REQUEST as $k => $v)
{
    $_REQUEST[$k] = stripslashes($v);
}

Not very scientific, but it has never failed me yet ;-)
0
joyacv2Author Commented:
Hi,

But how i can change the setting directly with .htaccess?
0
Dave BaldwinFixer of ProblemsCommented:
0
joyacv2Author Commented:
But where i enter this line of code?
0
Dave BaldwinFixer of ProblemsCommented:
In your '.htaccess' file which goes in the root directory of your web site.  You will probably have to create the file because it is only used when you need to tell Apache and PHP about something different than the normal configuration.  http://httpd.apache.org/docs/current/howto/htaccess.html
0
joyacv2Author Commented:
Can you give me a brief guide on where and how create this file?
0
Dave BaldwinFixer of ProblemsCommented:
I thought I just did with the links to the PHP and Apache pages.  In the simplest version, you create a file called '.htaccess', put that line in it, and save it in the root directory of your web site.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.