If you are a webmaster sooner or later you will have to copy the php.ini in each folder of your ftp site, to apply the changes you made in the mentioned file or to give a better protection to the whole structure of your website. A hard solution is to copy this file by hand in each folder, but why to do so when there is a nice piece of code that makes this work for you? Here is the trick
- – Start Script Here – -
<?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 = “Y”;
if ($overwriteOnly == “Y”) echo “Operating in Overwrite Only Mode<br><br>”;
$path = “/home/” . get_current_user() . “/public_html”;
$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.”;
?>
Tags: security, trick
Related ArticlesLatest Articles
- How to Automatically Login (Access) to Windows 8
- How to See and Read Unread, Archived and Sent Messages on Facebook
- Switch to the New Facebook Profile Layout (Timeline)
- How to Discover and Recover All Stored Passwords in your Windows Computer
Leave a Comment
Web Talk is best viewed in Firefox.
Comments
How to change language in Windows 7: i thought upon installation of Windows they warn you that you can not change the...
Can I Turn on Facebook Chat Auto Reply?: Thanks for explaining, otherwise it would have been a good option, but there are...
How to fix “Windows Explorer has stopped working” in Windows 7: simple remember if you download some new app....
How to Fix uTorrent not Working on Windows 7: desai .. first exit from process .. then try to uninstall
Use online Virtual Windows Operating System directly on your browser: a
Download 64-bit Windows 7 Build 7077 DVD ISO leaked version: hai ptoravo a disinstallare msn con l’applicazione...
Right click on shortcuts icons don’t show “open file location” in Vista: The sorhensect provided above...
Uninstall and Remove AVG Security Search Toolbar and AVG Secure Search: google jobb
Microsoft launches innovative translate widget for blogs: Definitely! It’s rlelay weird at first but...
Small, Hilarious List of Funny Google Translate Tricks: Try this: men are men and men do the cooking, translate to Dutch,...