Changing the php.ini without access

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.

You may also like...

1 Response

  1. mabako says:

    You might also want to have a look at for other options to directly modify the php-config within apache.

    Actually for my webhosting on lighttpd, every user has an own php.ini which is adjusted to what they’d need. Every setting not set from this “special” php.ini will be taken from the global config, so it doesn’t work a lot different.

Leave a Reply

Your email address will not be published. Required fields are marked *