Skip to content

Instantly share code, notes, and snippets.

@charleslouis
Last active August 29, 2015 14:14
Show Gist options
  • Save charleslouis/c9e7bdbdb4a27b2cff1f to your computer and use it in GitHub Desktop.
Save charleslouis/c9e7bdbdb4a27b2cff1f to your computer and use it in GitHub Desktop.
#wordpress #php.ini #php - increase memory size using php.ini in 1&1 servers for wordpress
upload_max_filesize = 125M
post_max_size = 125M
memory_limit = 64M
<pre><?php
// set this value to Y if you only want to overwrite old php.ini files
// set this value to N if you want to put a php.ini file in every directory
$overwriteOnly = "N";
if ($overwriteOnly == "Y") echo "Operating in Overwrite Only Mode<br><br>";
$path = "/homepages/xx/dxxxxxxxxx/htdocs";
$source = $path . "/php.ini";
if (!file_exists($source)) die('Error - no source php.ini file');
function search($dir) {
global $source;
global $overwriteOnly;
$dh = opendir($dir);
while (($filename = readdir($dh)) !== false) {
if ( $filename !== '.' AND $filename !== '..' AND $filename !== 'cgi-bin' AND is_dir("$dir/$filename") ) {
$path = $dir."/".$filename;
$target = $path . "/php.ini";
if (!file_exists($target) AND $overwriteOnly == "Y") {
echo "$path <b>skipped - no php.ini file</b><br>";
} else {
echo "$target <br>";
if (!copy($source,$target)) echo "<b>Write failed for $target </b><br>";
if (file_exists($target)) chmod($target,0600);
}
search($path);
}
}
closedir($dh);
}
search($path);
echo "<br>Done.";
?></pre>
- See more at: http://www.mistipi.com/wordpress-php-11-augmenter-la-memoire-allouee/#sthash.KH9GfSoJ.dpuf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment