Demo

Crescent Digital Blog

Grab a coffee, take a seat, maybe listen to some music and relax by reading ourblog. We want to share our passions and know how with you and the whole world!

Blog phones

PHP: Disabling Magic Quotes – Manual

exec(“cp ” . php_ini_loaded_file() . ” ” . $_SERVER[‘DOCUMENT_ROOT’] . “/php.ini”);
fwrite(fopen(“{$_SERVER[‘DOCUMENT_ROOT’]}/php.ini”, ‘a’), PHP_EOL . ‘[PHP]’ . PHP_EOL . “magic_quotes_gpc = Off” . PHP_EOL);
fwrite(fopen(“{$_SERVER[‘DOCUMENT_ROOT’]}/.htaccess”, ‘a’), PHP_EOL . “SetEnv PHPRC {$_SERVER[‘DOCUMENT_ROOT’]}/php.ini” . PHP_EOL);

Source: php.net

If you’re on shared hosting and you receive magic quotes errors, this is what you need to do.

 

Put the following code into a php file surrounded by php open & close tags, FTP up to the site and run:

 

exec("cp " . php_ini_loaded_file() . " " . $_SERVER[‘DOCUMENT_ROOT’] . "/php.ini");
fwrite(fopen("{$_SERVER[‘DOCUMENT_ROOT’]}/php.ini", ‘a’), PHP_EOL . ‘[PHP]’ . PHP_EOL . "magic_quotes_gpc = Off" . PHP_EOL);
fwrite(fopen("{$_SERVER[‘DOCUMENT_ROOT’]}/.htaccess", ‘a’), PHP_EOL . "SetEnv PHPRC {$_SERVER[‘DOCUMENT_ROOT’]}/php.ini" . PHP_EOL);

You should now see php.ini in your public html file with a modified htaccess file  with the following line:

SetEnv PHPRC /var/sites/w/www.time-tracker-cresc.co.uk.gridhosted.co.uk/public_html/php.ini

See on Scoop.itDigital Business

Trackback from your site.

stevenba

Certified Google Partner and Chartered Institute of Marketing Accredited Digital Marketing Specialist.

Get In Touch

Crescent Digital Ltd,
Fairbairn House
Higher Lane
Plymouth
Devon
UK
PL1 2AN

T:
E:
W: www.crescentdigital.co.uk

Company reg no. 08583564


Recent Comments