views:

333

answers:

8

I opened the notepad, inserted 3 lines in it, saved it as php.ini, and uploaded it in public_html, but I am still getting an error that requires to first switch the magic quotes off. The syntax of the three lines is as following:

magic_quotes_gpc = 0 
magic_quotes_runtime = 0 
magic_quotes_sybase = 0

What am I doing wrong?

A: 

Did you restart the web server?

anon
Man the server is with the hosting company. That's why I need the php.ini file. But all I did was what I could find on the net. I understand that php.ini should be in the www folder, if not in the installation directory.
+3  A: 

use phpinfo() function to see what php.ini file you're actually using

vartec
A: 

Well, you have to change your main php.ini which I don't think is in public_html. Moreover, in order to see the changes you have to restart your php engine.

Pooria
I actually read about it a lot in the Internet, and since many days. Now I did only what I concluded, but which is not working. So probably this host has wasted a lot of my time by saying "make your own php.ini". So, you people might be right that I should contact the host.Thx.
A: 

It's not meant to be placed in the public_html folder... it should be in your PHP installation folder.

rogeriopvl
Some shared hosts may support uploading custom php.ini files in the public_html folder.
A: 

Php.ini is not usually located in public_html. If you can't access your real php.ini, try writing

php_flag magic_quotes_gpc off

in a .htaccess file (in public_html).

Joonas Pulakka
Do I write it the same way you have written?php_flag magic_quotes_gpc off
Yes, just like that.
Joonas Pulakka
+1  A: 

You can probably alter these settings in a .htaccess configuration file as well:

php_flag magic_quotes_gpc off
php_flag magic_quotes_runtime off
php_flag magic_quotes_sybase off

See PHP: How to change configuration settings.

Gumbo
A: 

Most hosting companies won't let you play around with the php.ini unless you rent a dedicated server from them. On that, you could try on page php.ini settings like the following:

ini_set("magic_quotes_gpc", "0");
ini_set("magic_quotes_runtime", "0"); 
ini_set("magic_quotes_sybase", "0");

If that doesn't work, then you'll have to ask your hosting company about it.

random
Don't I need the PHP tags '<? and ?>'?
I did what you said but no use.
The lines should go into your page, just after the first <? and before the rest of the code. If they don't do anything, then the hosting company has disallowed editing of this outside of the php.ini
random
A: 

Most hosting companies lets you define a local ini file. Check their support pages, and see where you should put your php.ini file for it to be read by the php engine. If they have an option for this, you don't have to worry about restarting the server.

If you can't find any info about it, create a page with the following code:

<?php phpinfo(); ?>

And look for the property named "Configuration File (php.ini) Path". This is where you should put the file.

Erik
I am unable to understand you. What name should I give the file and to which directory should I upload? I have the Crimson Editor.Thx.
Wow that cool! I uploaded it in a folder, and when I opened the file by its name, now I have a lot of information on a webpage, mainly tables.
This is the path for the php.ini:/usr/lib
But I am unable to find this directory. Thx.
Do you have access to the folder /usr/lib? If so, you should change the ini file located there, or put your own ini file there if no file exists.
Erik
Oh no man... looks like we are forgetting one thing: that this folder is going to be in Gurgaon (New Delhi neighbourhood), on the server! That's why I can't access it.Thx.
I scolded my host holding him responsible for the utter wastage of my 2 months. Guess what... I have a free 21mB PHPWebsite installation waiting to be installed for my video site, and yet I was STUDYING PHP to start a site!
Anyways, thanks to everybody here; I am a little shaken looking at the speed of the replies on this site! Of course I am overwhelmed!Thank you so much and regards everybody!
hp1: I recommend the suggestions above about putting the ini settings into your .htaccess file or using ini_set before chewing out your hosting provider for standard practices