Miscellaneous Knowledge

Changing the php.ini without access

by KingJ on Aug.16, 2008, under An Interesting Find

Recently, I needed to turn on magic quotes for a customer on our web hosting. Now, our web hosting is not actually hosted by me, rather I purchase a reseller package. This allows me to offer cPanel access without having to spend an absolute fortune on it. However, it means I don’t have access to the php.ini and hence can’t turn on magic quotes.

Now, I wouldn’t want it on anyway (and it’s quite bad apparently) so how could I enable it just for this customer?

The answer? .htaccess . I have always thought .htaccess as just a file that controls access, not an entire config. Adding the following line

php_flag magic_quotes_gpc on

Turns Magic Quotes on for that user. Awesome.

There is a lot more that can also be configured via the .htaccess too, such as extension handling and more. Have a look into it if you’re intested.

:, ,

1 Comment for this entry

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...