<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>elxsy &#187; apache</title>
	<atom:link href="http://www.elxsy.com/tag/apache/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.elxsy.com</link>
	<description>where humanity wins the fight against machines</description>
	<lastBuildDate>Mon, 15 Aug 2011 10:08:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Installing ImageMagick on Windows and Using with PHP &#8211; Imagick</title>
		<link>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/</link>
		<comments>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 16:20:35 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[exe]]></category>
		<category><![CDATA[imagick]]></category>
		<category><![CDATA[imagick dll]]></category>
		<category><![CDATA[imagick installation]]></category>
		<category><![CDATA[imagick on windows]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[photoshop]]></category>
		<category><![CDATA[php 5.2]]></category>
		<category><![CDATA[php convert image]]></category>
		<category><![CDATA[php image manipulation]]></category>
		<category><![CDATA[php imagick dll]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[windows xp]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=265</guid>
		<description><![CDATA[As most of your know ImageMagick is like the photoshop on your console demand. Best with their explanation. ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, [...]


No related posts.]]></description>
			<content:encoded><![CDATA[<p>As most of your know <a href="http://imagemagick.org/script/index.php">ImageMagick </a>is like the photoshop on your console demand. Best with their explanation.</p>
<blockquote><p>ImageMagick<sup><a href="http://tarr.uspto.gov/servlet/tarr?regser=serial&amp;entry=78333969">®</a></sup> is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of <a href="http://imagemagick.org/script/formats.php">formats</a> (over 100) including <a href="http://imagemagick.org/script/motion-picture.php">DPX</a>, <a href="http://imagemagick.org/script/high-dynamic-range.php">EXR</a>, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.</p></blockquote>
<p>It is very powerful and supports all platforms with tons of different languages and implementations. Because my hosting solutions did not suppot it (many of them dont do as well) I always used awesome GD library to process images on my projects. Well now my hosting does support and I am going to use it so I needed to install it to my development environment which is windows. I am going to install and use Imagick also because using IM from native PHP is much more faster than using it from console via exec.</p>
<p>Well first of all ImageMagick on windows with PHP is a really pain in the ass, if you have the commitment and time go for it otherwise use it from console. Here are the steps and todo's to install for <strong>PHP 5.2.x</strong>, ( I dont know if it works with PHP 5.3.x or below, you will need to test for yourself. I am a happy camper for now ).</p>
<h3><span style="color: #ff6600;">UPDATE</span></h3>
<p>Just to make things clear, all the PHP dll files (librarires) are 32 bit, so if your system is 64 bit and you will still need to download and operate 32 bit ImageMagick, Apache, etc.</p>
<h3><span id="more-265"></span>1 Download ImageMagick</h3>
<p>Go to <a href="http://imagemagick.org/script/binary-releases.php#windows">http://imagemagick.org/script/binary-releases.php#windows</a> to download the latest version, which is <strong>ImageMagick-6.5.4-2-Q16-windows-dll.exe</strong></p>
<p>Now the beauty, static versions are suppose to work with every platform but they act really funny so you should download a dynamic version. If you system/pc supports go for 16 bit Q16. The difference is explained on the link very well.</p>
<p>Now in my case, the latest version did not work so I had to go through old versions and <strong>ImageMagick-6.4.2-7-Q16-windows-dll</strong> version worked like charm for me. My system is <strong>Windows XP SP2, 32 Bit, Intel Centrino 1.76GHZ.</strong> You can download the older versions from <a href="http://image_magick.veidrodis.com/image_magick/binaries/">here</a>.</p>
<p>I suggest you to download and try the latest one, complete all steps, if it doesnt work try with a lower version and so on.</p>
<h3>2 Install ImageMagick</h3>
<p>Install the IM on a path like <code>C:\imagemagick\</code> with no spaces and simple location. Do not go for c:\program files\etc</p>
<p><span style="color: #ff0000;">Do not forget</span> to click on the "<strong>Add to system path</strong>" checkbox. You can ignore the rest of the checkboxes</p>
<h3>3 Testing the Installation</h3>
<p>Open the command prompt (Run-&gt;"CMD"-&gt;ENTER) and type in <strong>convert</strong> and press enter. You should see the help parameters of convert. If so go to <strong>step 4.</strong></p>
<p>if it says its failed or unknown function or type in a parameter to convert ( which is a default function in Windows XP to convert HDD from FAT32 to NTFS or vice varsa ) you need to add path to environment by yourself.</p>
<p>My Computer -&gt; Right Click -&gt; Properties -&gt; Advanced (Tab) -&gt; Environment Variables (at the bottom) -&gt; System Variables (Section) -&gt; Scroll to Find "<strong>Path</strong>" -&gt; Select it and click <strong>Edit</strong> -&gt; Add your installation directory to there.</p>
<h3>4 Downloading the php_Imagick.dll</h3>
<p>Again the version problem, well if you are using <strong>PHP 5.2.x</strong> this is <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/">where you will get your</a> dll.</p>
<p>dyn = dynamic, st = static, q16 = 16 bit, q8= 8 bit. This should match your downloaded version of course. If you downloaded q16 dynamic library, your file will be <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/080709/php_imagick_dyn-Q16.dll">php_imagick_dyn-Q16.dll</a></p>
<p>If you are using <strong>PHP 5.3.x</strong>, <a href="http://valokuva.org/outside-blog-content/imagick-windows-builds/php53/">this is your location</a> to download.</p>
<h3>5 Find and Place the dll in your extension folder</h3>
<p>Rename the downloaded dll to <strong>php_imagick.dll</strong> for easy usage and place it under your extension folder. It is usually <code>php/ext/</code>. Go to <strong>Step 6</strong>.</p>
<p>If it is not, then you can find it in your php.ini file with the extension_dir param.<br />
<code>; Directory in which the loadable extensions (modules) reside.<br />
extension_dir = "Something something"</code></p>
<h3>6 Edit PHP.ini</h3>
<p>Uncomment if it exists or add if it doesnt exist this line<br />
<code>extension=php_imagick.dll</code></p>
<h3>7 Restart</h3>
<p>This is the important part, I spent good half an hour trying to make it work.. grrrr.. You need to restart your PC to libraries take effect.</p>
<p>If you do not restart and start your apache you will see an error like. So please do restart your PC.</p>
<blockquote><p>Unable to find CORE_RL_Wand.dll something something.</p></blockquote>
<h3>8 Start Apache and check</h3>
<p>Start your apache, and check with the <strong>phpinfo()</strong> , if you see imagick library and its values thats it you are set. go to <strong>step 9</strong>.</p>
<p>If not you have picked up the wrong dll file for PHP. Browse through the directory and try another dlls, if they dont work try to lower your ImageMagick installation version. Dont give up, it will work.</p>
<h3>9 Test with some code</h3>
<p>Put a nice big picture named <strong>a.jpg</strong> along side with your<strong> test.php</strong> script, run the test and check the directory to see <strong>a_thumnail.jpg</strong>. Here is the script, simple and fast <img src='http://www.elxsy.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre class="brush:php">&lt;?
$im = new imagick( 'a.jpg' );
// resize by 200 width and keep the ratio
$im-&gt;thumbnailImage( 200, 0);
// write to disk
$im-&gt;writeImage( 'a_thumbnail.jpg' );
?&gt;</pre>
<h3>10 Manual, Learning and Playing Around</h3>
<p>To use it from php all you need is  <a href="http://uk3.php.net/imagick">PHP functions and manual</a> including some examples as well.</p>
<p>If you want to go further and mess around <a href="http://www.imagemagick.org/Usage/">here is the</a> command line ( exec() ) parameters, manuals and examples</p>
<h2>Finally</h2>
<p>So this is it, I hope you get it to work at the first trial now and drop a comment if you have any useful information or experience any error, we will try to help you out.</p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/07/installing-imagemagick-on-windows-and-using-with-php-imagick/feed/</wfw:commentRss>
		<slash:comments>65</slash:comments>
		</item>
		<item>
		<title>How to identify and ban bots-spiders-crawlers</title>
		<link>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/</link>
		<comments>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/#comments</comments>
		<pubDate>Mon, 08 Jun 2009 19:05:02 +0000</pubDate>
		<dc:creator>cenOTapH</dc:creator>
				<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[.htaccess]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[awstats]]></category>
		<category><![CDATA[ban]]></category>
		<category><![CDATA[bot]]></category>
		<category><![CDATA[bot-trap]]></category>
		<category><![CDATA[crawler]]></category>
		<category><![CDATA[identify]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[leecher]]></category>
		<category><![CDATA[robots]]></category>
		<category><![CDATA[robots.txt]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[spider]]></category>
		<category><![CDATA[trap]]></category>
		<category><![CDATA[visitor]]></category>

		<guid isPermaLink="false">http://www.elxsy.com/?p=158</guid>
		<description><![CDATA[This is a fast step tutorial. I will describe how to identify and get rid of web spiders/crawlers. Whats is a bot and what it does, how it functions etc all can be found here So you are trouble with robots, good or bad does not matter. They all leech away your bandwith and resources [...]

<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This is a fast step tutorial. I will describe how to identify and get rid of web spiders/crawlers. Whats is a bot and what it does, how it functions etc all can be found <a href="http://www.robotstxt.org/orig.html">here</a> So you are trouble with robots, good or bad does not matter. They all leech away your bandwith and resources and just maybe do something for you in return. Even though they are not harvasting or spammer bots. This problem goes beyond bandwidth when you have like 100,000 dynamic pages under one server.  So how do we seperate them as good or bad?  <span id="more-158"></span></p>
<h2>First Intention:</h2>
<ol>
<li><strong>Good ones</strong>
<ol>
<li><strong>Intentionally good and result is efficient</strong>: Like google and yahoo. They scan your website and return visitors via search queries in exchange. They leech away your resources but give something in return.</li>
<li><strong>intentionally good but result is inefficient</strong> : Like cuil or yandex or other wanna look good but index selling companies.  Leeching your resources and nothing in return. This is the place where you want to decide, if a bot leeches away 5% of your bandwith and return 5 visitors in a month or none. You should list that one as bad also.</li>
</ol>
</li>
<li><strong>Bad ones</strong> : Ones that scans your website and links in order to harvest emails, content, links and weak security measures and sell them to other people, businesses and other sources. Leeching from your back in other words. They are all bad and should not be allowed to view your contents.</li>
</ol>
<h2>Second Identification and Obeying your Rules:</h2>
<ol>
<li><strong>Who identifies and obeys :</strong> Usually who identifies themselves as some robot or spider, they obey the robots.txt rules.  Sometimes they do not.</li>
<li>Who doesnt: Usually harmfull bots identify themselves as normal web users and they do not care about robots.txt</li>
</ol>
<h1>Method</h1>
<h2>1st Good and Obeying ones</h2>
<h3><span style="text-decoration: line-through;">Tag and ban bad ones</span></h3>
<p>This should be the old method. There used to be maybe 10 bots around the internet that can leech and scan important amounts due to low resources but now home-grown spiders are around everyday and minute with large resources. So specifying who is <strong>bad </strong>in a 95% bad ratio world is not smart.</p>
<h3>Tag and Allow only good ones</h3>
<p>This should be the appropriate solution for the problem now. Only allow good ones via robots.txt. In my case they are only big and useful search engines for me. Sample robots.txt that allows the ones with specified identification and disallows the rest.</p>
<pre class="brush:perl">User-agent: Googlebot
User-agent: Slurp
User-agent: msnbot
User-agent: Mediapartners-Google*
User-agent: Googlebot-Image
User-agent: Yahoo-MMCrawler
Disallow: 

User-agent: *
Disallow: /</pre>
<p>so we got rid of the intentionally good, or bad but useless and rule obeying ones. How to get rid of disobeying ones?</p>
<h2>2nd Bad and disobedient ones</h2>
<p>If you are using apache (and you should use apache!) you can ban them via user agent or user ip. So why are we banning via agent? They can use any IP adress and many bots have IP ranges like xx.xx.xx.10-100 but some of them gets a new IP adress whenever they want or as a backend crawler so you can miss them. User agent allows to get them whatever the IP is.</p>
<h3>Ban via user agent</h3>
<p>Create your .htaccess file or modify existing one and add the bots user agents with respecting values. Sample:</p>
<pre class="brush:perl">RewriteCond %{HTTP_USER_AGENT} .*Rapidmorebot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Gigabot.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Yanga.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^Baiduspider.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^AISearchBot.*
RewriteRule ^.* - [F]</pre>
<p>What we did is we told the apache web server that if any request's user agent parameter matches the given values, redirect them to an access denied page.</p>
<p><strong>.*etc*.</strong> shortly means, if includes the etc string in any position</p>
<p><strong>^etc.*</strong> means if it begins with etc and goes with anything</p>
<p><strong>[OR] </strong>means OR.  Note : If you leave the OR parameter, it will act as an AND and will not block any bots.</p>
<p>You can use regular expressions in Rewrite cond and rules. Search on the internet for more information. You can add or remove as many lines/bots as you desire</p>
<h3>Ban via IP address</h3>
<p>If they do not identify themselves or fake it, we are going to ban them via IP adresses.  You can specify single IP or IP ranges in them. Again create or modify your .htaccess. Insert your bot's IP into necessary fields and repeat them until you are all done.</p>
<pre class="brush:perl">order allow,deny
deny from 127.0.0.1 # only ban ip from #dddd
deny from 127.0.0.1/17 # ban through 1 to 17
allow from all # and allow the rest</pre>
<p>You can edit these settings from your hosting cpanel management also.</p>
<h1>Identifying Bots</h1>
<p>We are not bulletproof althout we only let selected good ones, ban the ones we caught. There will be always new bots and updates to existing ones that can make ur settings and rules become invalid. We need to be upto date also. So how do we identify them?</p>
<h2>1st General Knowledge</h2>
<p>Of course you are not the only one facing this problem. People started to make lists and publish them because these bots annoyed them too much and they wanna help other people like you also. So here is some databases of known bots/spiders. Note : These databases are not upto date and they do not include all spiders, just the generally known ones. You should try to catch your manually and then consult these dbs to check your result.</p>
<p><a href="http://www.robotstxt.org/db.html">http://www.robotstxt.org/db.html</a></p>
<p><a href="http://www.iplists.com/">http://www.iplists.com/</a></p>
<h2>2nd via Hosting logs | Some stats analyzer</h2>
<p>You can manually analyze your hosting logs, bandwith usage, pages to get most hit from singular ips or you can use an application like <strong>awstats</strong> or commercial solutions like weblogexpert to analyze your logs for you and create reports for you.</p>
<div id="attachment_159" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/h1.jpg"><img class="size-full wp-image-159" title="h1" src="http://www.elxsy.com/wp-content/uploads/2009/06/h1.jpg" alt="Awstats spider/bot list" width="600" height="172" /></a><p class="wp-caption-text">Awstats spider/bot list</p></div>
<p>Awstats identifies them by hits on robots.txt and user agent string. You can have the user agent but you are unprotected against unknown and IP values.</p>
<p>You can detect if any bots leeching on your website in easy analysis.</p>
<ol>
<li>Did "time spent on webpage" decreased suddenly? Bots get a page and exit, so they stay less then 2-3 seconds in your page. Humans will be able to load the page in this time only. So if these ratio goes higher it means you have a spider inside. You can track it down by finding request IPs with short "spent time" values.</li>
<li>Did hits on a pages  increased suddenly? In general rules, you will attract visitors slowly, your hits wont be 10 one day and 1000 other day if everything working ok. You have a spider inside.</li>
<li>Did your bandwith increased suddenly? You have a spider leeching on u.</li>
</ol>
<p>All these rules applies to awstats Hosts section, you can have their IP and their agents via spider db I gave previously. So lets analyze one of my Host sectiona and find bots manually via their IP. Lets analyze the IPs and area in red drawing.</p>
<div id="attachment_160" class="wp-caption aligncenter" style="width: 715px"><a href="http://www.elxsy.com/wp-content/uploads/2009/06/h2.jpg"><img class="size-full wp-image-160" title="h2" src="http://www.elxsy.com/wp-content/uploads/2009/06/h2.jpg" alt="h2" width="705" height="253" /></a><p class="wp-caption-text">Awstats Host section</p></div>
<ol>
<li>line is a bot or a service (dns, ping, etc) no way a human being can hit that many pages in one day and spend 20mb bandwith. We download a page with its all attachments (images, scripts, styles) like a size of 400kb in my condition (pages are huge). But bots only download the text content, so its relatively small compared to the original size (7-8Kb). (cache is not included because i know it is a dynamic image page )</li>
<li>line is definitely a bot and pretty bad one (<strong>zoozle.net you should ban it</strong>!) wasted 1.5gb in one day! I hope you see the importance of eliminating bots on your system health now!</li>
<li>and so on.. they are all spiders - services crawling - pinging  the website.</li>
</ol>
<h2>3rd Setup a Bot Trap</h2>
<p>Even your analyze can overlook some small but in time big trouble creator bots. What we can do is to setup a bot trap for them to fall in.  What we are going to do is to create a trap link which records visitors details. Publish that link on your website via invisible properties and then tell the good and obeying bots to not to go over forbidden zone. So whoever do not listen to what we say will be get tagged.  Method depends on if you want them in a database or in a logfile or via email.</p>
<p><strong>1st </strong>Create a weird link in your web site like www.example.com/this-is-trap-dont-click-it/index.php and add</p>
<p><strong>2nd</strong> contents of the .php file is</p>
<pre class="brush:php">$ip 		= $_SERVER['REMOTE_ADDR'];
$host		= $_SERVER['HTTP_HOST'];
$agent 		= $_SERVER['HTTP_USER_AGENT'];
$referer	= $_SERVER['HTTP_REFERER'];
$time		= date("d.m.Y H:i");
// mail, write in log file or insert into db depending on your choice</pre>
<p><strong>3rd </strong>Put in your footer a link to that weird link and make the link same color as background color, or put an 1X1 transparent gif into the link. ie</p>
<pre>&lt;!-- Trap for bots. Human visitors please do not visit this adress --&gt;
&lt;a href="this-is-trap-dont-click-it/index.php"&gt;&lt;img src="1_by_1pixel.gif" border="0"
alt="Please do not visit, its a trap for bots" width="1" height="1"/&gt;&lt;/a&gt;</pre>
<p><strong>4th</strong> add these lines to your robots.txt. Which will tell good and obedient bots not to follow the link and get in trouble.</p>
<pre class="brush:perl">User-agent: *
Disallow: /this-is-trap-dont-click-it</pre>
<p>So here our bot trap is set and finished finally. Analyze your trap logs and ban them via your criteries (leeching - new visitors ) and their behaviour.</p>
<p>Thats it, hope you enjoyed the post.</p>


<div class="promote clear" style="background:#EDEDED"><h3>Related posts</h3><ol><li><a href='http://www.elxsy.com/2009/06/imhuman-wordpress-plugin-0-0-9-test-run/' rel='bookmark' title='ImHuman WordPress Plugin 0.0.9 Test Run'>ImHuman WordPress Plugin 0.0.9 Test Run</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.elxsy.com/2009/06/how-to-identify-and-ban-bots-spiders-crawlers/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
