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.