May 2010
1 post
6 tags
[apache] [security] Apache Bot filtering with...
Fail2ban scan log files like /var/log/apache/error_log and bans IP that makes too many bad request.
Fail2ban block bruteforcers, scanners and many other…
For more information about fail2ban see : www.fail2ban.org
Fail2ban can also be used to ban bad bots on apache.
The blocking list is fetched from www.user-agents.org.
To block spam or bad robot who visit your...
March 2010
1 post
2 tags
[php] htmlentitiesnotag
function htmlentitiesnotag($strIn){
$arrEntities = array('<','>','"','&');
$arrTag = array('<','>','"','&');
$strOut = htmlentities($strIn);
$strOut = str_replace($arrEntities,$arrTag,$strOut);
return $strOut;
}
February 2010
1 post
7 tags
[php-cli] [mysqldump] [cron] auto backup mysql...
You need to automatise the backup of your mysql databases on a linux system with php-cli, mysqldump and bzip2 ?
So this script is for you ^^
I use this script on my servers to backup my databases every nigth.
All Databases of the 15 last days and 2 by month are stored in bzip2 format in separate files (one file by database).
Set your preferences in this script, add it in...
January 2010
5 posts
3 tags
[shell] string replace in all file recursively
Replace all occurrences of the EXPR_SEARCH expression with the EXPR_REPLACE expression in all files of DIRECTORY_PATH recursively
sed -i -e 's/EXPR_SEARCH/EXPR_REPLACE/g' `grep -lR 'EXPR_SEARCH' DIRECTORY_PATH`
Note : don’t forget to escape special characters in your expression (ie : ‘images/site’ will be ‘images\/site’ )
3 tags
[php] [ubuntu] Install APC on ubuntu
Install APC (Alternative PHP Cache) to increase server performance.
On Ubuntu 9.10 :
sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart
On Ubuntu 8.04 :
Install pre-required packages
sudo apt-get install php-pear php5-dev apache2-threaded-dev make
Install APC with PECL
sudo pecl install apc
If succeed, add extension=apc.so to your...
1 tag
1 tag
[php] rglob
if (!function_exists('rglob')){
function rglob($sDir,$sPattern, $nFlags = NULL) {
$sDir = escapeshellcmd($sDir);
$aFiles = glob("$sDir/$sPattern", $nFlags);
foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) {
$aSubFiles = rglob($sSubDir, $sPattern, $nFlags);
$aFiles = array_merge($aFiles, $aSubFiles);
}
return $aFiles;
}
}
Hello World
Chef de projet developpeur web lyonnais #geek #apero #ski #sun #php #linux #shell #dev #web
Follow me at http://twitter.com/rauxbenoit