Skip to content

Instantly share code, notes, and snippets.

@zomars
Created April 8, 2015 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zomars/48e6883c392b1e7f0ae1 to your computer and use it in GitHub Desktop.
Save zomars/48e6883c392b1e7f0ae1 to your computer and use it in GitHub Desktop.
Fix the Magic Spaces PHP Issue in some shared hosts
<?php
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);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment