<?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>php genious &#187; IIS</title>
	<atom:link href="http://www.phpgenious.com/category/iis/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.phpgenious.com</link>
	<description></description>
	<lastBuildDate>Fri, 01 Feb 2013 19:08:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Send PHP mail using SMTP</title>
		<link>http://www.phpgenious.com/2010/04/send-php-mail-using-smtp/</link>
		<comments>http://www.phpgenious.com/2010/04/send-php-mail-using-smtp/#comments</comments>
		<pubDate>Mon, 12 Apr 2010 13:43:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[IIS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP and SMTP]]></category>
		<category><![CDATA[PHP mail using SMTP authentication]]></category>
		<category><![CDATA[Send Mail using SMTP]]></category>
		<category><![CDATA[SMTP mail]]></category>

		<guid isPermaLink="false">http://www.phpgenious.com/?p=390</guid>
		<description><![CDATA[Hello Friends !! TOday I found that how PHP mail() function works with SMTP. Actually when your site is hosted on windows server, then there is SMTP used for sending [...]]]></description>
				<content:encoded><![CDATA[<p>Hello Friends !! TOday I found that how PHP mail() function works with SMTP.</p>
<p>Actually when your site is hosted on windows server, then there is SMTP used for sending mail. With simple mail() function ,you can&#8217;t send mail in SMTP.</p>
<p>You have to authenticate PHP and SMTP. In short, I explain you that how to send PHP mail using SMTP ?</p>
<p>For sending mail in PHP using SMTP, first of all you have to download phpMailer. phpMailer is a class which used to send mails using SMTP.<span id="more-390"></span></p>
<p>You can download phpMailer from <a href="http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/PHPMailer%20v5.1/PHPMailer_v5.1.zip/download" target="_blank">here</a>.</p>
<div class="code">
<p>&lt;?php</p>
<p>//this is a path to PHP mailer class you have dowloaded</p>
<p>include(&#8220;class.phpmailer.php&#8221;);</p>
<p>$mail = new PHPMailer();</p>
<p>$mail-&gt;IsSMTP();                            // set mailer to use SMTP</p>
<p>$mail-&gt;Host = &#8220;SMTP server name &#8220;;        // specify main and backup server</p>
<p>$mail-&gt;SMTPAuth = true;                        // turn on SMTP authentication</p>
<p>$mail-&gt;Username = &#8220;SMTP username &#8220;;    // SMTP username</p>
<p>$mail-&gt;Password = &#8220;SMTP password&#8221;;            // SMTP password</p>
<p>$mail-&gt;From = &#8220;frm Email &#8220;;    //do NOT fake header.</p>
<p>$mail-&gt;FromName = &#8220;MailMan&#8221;;</p>
<p>$mail-&gt;AddAddress(&#8220;to email ID &#8220;); // Email on which you want to send mail</p>
<p>$mail-&gt;AddReplyTo(&#8220;Reply to Email &#8220;, &#8220;Support and Help&#8221;); //optional</p>
<p>$mail-&gt;IsHTML(true);</p>
<p>$mail-&gt;Subject = &#8220;Just a Test&#8221;;</p>
<p>$mail-&gt;Body    = &#8220;Hello. I am testing &lt;b&gt;PHP Mailer.&lt;/b&gt;&#8221;;</p>
<p>if(!$mail-&gt;Send())</p>
<p>{</p>
<p>echo $mail-&gt;ErrorInfo;</p>
<p>}else{</p>
<p>echo &#8220;email was sent&#8221;;</p>
<p>}</p>
<p>?&gt;</p>
</div>
<p>Please save above code as <strong>testmail.php</strong> or whatever name you want but make it <strong>php.</strong></p>
<p>Please make sure that above script is stored in the folder in whu\ich you store <strong>class.phpmailer.php</strong> and <strong>class.smtp.php</strong>. These both class files are required for sending mail.</p>
<p>Thats it !! Now you can send PHP mails using SMTP. Feel free to comment on this post. Your feddback is importand to us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpgenious.com/2010/04/send-php-mail-using-smtp/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>URL Rewriting with PHP and IIS 7</title>
		<link>http://www.phpgenious.com/2010/04/url-rewriting-with-php-and-iis-7/</link>
		<comments>http://www.phpgenious.com/2010/04/url-rewriting-with-php-and-iis-7/#comments</comments>
		<pubDate>Thu, 01 Apr 2010 07:31:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTACCESS]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[SEO friendly URL]]></category>
		<category><![CDATA[URL Rewriting]]></category>
		<category><![CDATA[Web.config]]></category>

		<guid isPermaLink="false">http://www.phpgenious.com/?p=382</guid>
		<description><![CDATA[Hello friends !! Few days ago, I faced a URL rewriting problem on windows server. After checking the server configuration, I found that there is an II7 installed. After long [...]]]></description>
				<content:encoded><![CDATA[<p>Hello friends !! Few days ago, I faced a URL rewriting problem on windows server. After checking the server configuration, I found that there is an <strong>II7 </strong>installed. After long research about this, I found that <strong>II7 </strong>is not support <strong>.HTACCESS. </strong>If youwant to male your site SEO URL friendly, then you have to use <strong>web.config</strong> file for URL rewriting instead of <strong>.HTACCESS</strong>. Now the question is how to make <strong>web.config </strong>file from <strong>.HTACCESS </strong>?</p>
<p>IIS 7 uses a file called Web.config to hold settings for integration  with applications. The Web.config file contains information that control  module loading, security configuration, session state configuration,  and application language and compilation settings. Web.config files can  also contain application-specific items such as database connection  strings.<br />
Today in this post, I will explain you how to make it ? This post contains most common uses of the .htaccess file by PHP applications, and shows  how to use the Web.config file for these same functions in <strong>IIS</strong>.<br />
Now First Here are the sample files of <strong>.HTACCESS</strong> and <strong>Web.config.</strong><br />
<span id="more-382"></span></p>
<h4>.HTACCESS Sample code</h4>
<div class="code">
<p>#<br />
# Apache/PHP/Application settings:<br />
#</p>
<p># Protect files and directories from prying eyes.</p>
<p>Order allow,deny</p>
<p># Don&#8217;t show directory listings for URLs which map to a directory.<br />
Options -Indexes</p>
<p># Follow symbolic links in this directory.<br />
Options +FollowSymLinks</p>
<p># Make Application handle any 404 errors.<br />
ErrorDocument 404 /index.php</p>
<p># Force simple error message for requests for non-existent favicon.ico.</p>
<p>ErrorDocument 404 &#8220;The requested file favicon.ico was not found.</p>
<p># Set the default handler.<br />
DirectoryIndex index.php</p>
<p># Override PHP settings. More in sites/default/settings.php<br />
# but the following cannot be changed at runtime.</p>
<p># PHP 4, Apache 1.</p>
<p>php_value magic_quotes_gpc                0<br />
php_value register_globals                0<br />
php_value session.auto_start              0<br />
php_value mbstring.http_input             pass<br />
php_value mbstring.http_output            pass<br />
php_value mbstring.encoding_translation   0</p>
<p># PHP 4, Apache 2.</p>
<p>php_value magic_quotes_gpc                0<br />
php_value register_globals                0<br />
php_value session.auto_start              0<br />
php_value mbstring.http_input             pass<br />
php_value mbstring.http_output            pass<br />
php_value mbstring.encoding_translation   0</p>
<p># PHP 5, Apache 1 and 2.</p>
<p>php_value magic_quotes_gpc                0<br />
php_value register_globals                0<br />
php_value session.auto_start              0<br />
php_value mbstring.http_input             pass<br />
php_value mbstring.http_output            pass<br />
php_value mbstring.encoding_translation   0</p>
<p># Requires mod_expires to be enabled.</p>
<p># Enable expirations.<br />
ExpiresActive On</p>
<p># Cache all files for 2 weeks after access (A).<br />
ExpiresDefault A1209600</p>
<p># Do not cache dynamically generated pages.<br />
ExpiresByType text/html A1</p>
<p># Various rewrite rules.</p>
<p>RewriteEngine on</p>
<p># If your site can be accessed both with and without the &#8216;www.&#8217; prefix, you<br />
# can use one of the following settings to redirect users to your preferred<br />
# URL, either WITH or WITHOUT the &#8216;www.&#8217; prefix. Choose ONLY one option:<br />
#<br />
# To redirect all users to access the site WITH the &#8216;www.&#8217; prefix,<br />
# (http://example.com/&#8230; will be redirected to http://www.example.com/&#8230;)<br />
# adapt and uncomment the following:<br />
# RewriteCond %{HTTP_HOST} ^example\.com$ [NC]<br />
# RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]<br />
#<br />
# To redirect all users to access the site WITHOUT the &#8216;www.&#8217; prefix,<br />
# (http://www.example.com/&#8230; will be redirected to http://example.com/&#8230;)<br />
# uncomment and adapt the following:<br />
# RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]<br />
# RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]</p>
<p># Modify the RewriteBase if you are using Application in a subdirectory or in a<br />
# VirtualDocumentRoot and the rewrite rules are not working properly.<br />
# For example if your site is at http://example.com/application uncomment and<br />
# modify the following line:<br />
# RewriteBase /application<br />
#<br />
# If your site is running in a VirtualDocumentRoot at http://example.com/,<br />
# uncomment the following line:<br />
# RewriteBase /</p>
<p># Rewrite URLs of the form &#8216;x&#8217; to the form &#8216;index.php?q=x&#8217;.<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteCond %{REQUEST_URI} !=/favicon.ico<br />
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]</p>
<p># $Id: .htaccess,v 1.90.2.1 2008/07/08 09:33:14 goba Exp $</p>
</div>
<h4>Web.config Sample Code</h4>
<div class="code">&lt;?xml version=&#8221;1.0&#8243; encoding=&#8221;UTF-8&#8243;?&gt;<br />
&lt;configuration&gt;</p>
<p>&lt;configSections&gt;<br />
&lt;sectionGroup name=&#8221;system.webServer&#8221;&gt;<br />
&lt;sectionGroup name=&#8221;rewrite&#8221;&gt;<br />
&lt;section  name=&#8221;rewriteMaps&#8221; overrideModeDefault=&#8221;Allow&#8221; /&gt;<br />
&lt;section  name=&#8221;rules&#8221; overrideModeDefault=&#8221;Allow&#8221; /&gt;<br />
&lt;/sectionGroup&gt;<br />
&lt;/sectionGroup&gt;<br />
&lt;/configSections&gt;</p>
<p>&lt;system.webServer&gt;<br />
&lt;security&gt;<br />
&lt;!&#8211;  This section should be uncommented after<br />
installation to secure the installation. &#8211;&gt;<br />
&lt;!&#8211;<br />
&lt;requestFiltering&gt;<br />
&lt;denyUrlSequences&gt;<br />
&lt;add sequence=&#8221;engine&#8221; /&gt;<br />
&lt;add  sequence=&#8221;inc&#8221; /&gt;<br />
&lt;add sequence=&#8221;info&#8221;  /&gt;<br />
&lt;add sequence=&#8221;module&#8221; /&gt;<br />
&lt;add sequence=&#8221;profile&#8221; /&gt;<br />
&lt;add  sequence=&#8221;po&#8221; /&gt;<br />
&lt;add sequence=&#8221;sh&#8221; /&gt;<br />
&lt;add sequence=&#8221;theme&#8221; /&gt;<br />
&lt;add  sequence=&#8221;tpl(\.php&#8221; /&gt;<br />
&lt;add  sequence=&#8221;Root&#8221; /&gt;<br />
&lt;add sequence=&#8221;Tag&#8221;  /&gt;<br />
&lt;add sequence=&#8221;Template&#8221; /&gt;<br />
&lt;add sequence=&#8221;Repository&#8221; /&gt;<br />
&lt;add  sequence=&#8221;code-style&#8221; /&gt;<br />
&lt;/denyUrlSequences&gt;<br />
&lt;fileExtensions&gt;<br />
&lt;add  fileExtension=&#8221;.sql&#8221; allowed=&#8221;false&#8221; /&gt;<br />
&lt;add fileExtension=&#8221;.pl&#8221; allowed=&#8221;false&#8221; /&gt;<br />
&lt;/fileExtensions&gt;<br />
&lt;/requestFiltering&gt;<br />
&#8211;&gt;<br />
&lt;/security&gt;<br />
&lt;directoryBrowse  enabled=&#8221;true&#8221; /&gt;<br />
&lt;caching&gt;<br />
&lt;profiles&gt;<br />
&lt;add extension=&#8221;.php&#8221;  policy=&#8221;DisableCache&#8221; kernelCachePolicy=&#8221;DisableCache&#8221; /&gt;<br />
&lt;add extension=&#8221;.html&#8221; policy=&#8221;CacheForTimePeriod&#8221;  kernelCachePolicy=&#8221;CacheForTimePeriod&#8221; duration=&#8221;14:00:00:00&#8243; /&gt;<br />
&lt;/profiles&gt;<br />
&lt;/caching&gt;<br />
&lt;rewrite&gt;<br />
&lt;rules&gt;<br />
&lt;rule  name=&#8221;block favicon&#8221; stopProcessing=&#8221;true&#8221;&gt;<br />
&lt;match url=&#8221;favicon\.ico&#8221; /&gt;<br />
&lt;action type=&#8221;CustomResponse&#8221; statusCode=&#8221;404&#8243; subStatusCode=&#8221;1&#8243;<br />
statusReason=&#8221;The requested file favicon.ico was not found&#8221;<br />
statusDescription=&#8221;The requested file favicon.ico was not found&#8221; /&gt;<br />
&lt;/rule&gt;<br />
&lt;rule name=&#8221;Imported Rule 1&#8243;  stopProcessing=&#8221;true&#8221;&gt;<br />
&lt;match url=&#8221;^(.*)$&#8221;  ignoreCase=&#8221;false&#8221; /&gt;<br />
&lt;conditions&gt;<br />
&lt;add input=&#8221;{HTTP_HOST}&#8221; pattern=&#8221;^example\.com$&#8221; /&gt;<br />
&lt;/conditions&gt;</p>
<p>&lt;action type=&#8221;Redirect&#8221; redirectType=&#8221;Permanent&#8221;  url=&#8221;http://www.example.com/{R:1}&#8221; /&gt;<br />
&lt;/rule&gt;<br />
&lt;rule name=&#8221;Imported Rule 2&#8243;  stopProcessing=&#8221;true&#8221;&gt;<br />
&lt;match url=&#8221;^(.*)$&#8221;  ignoreCase=&#8221;false&#8221; /&gt;<br />
&lt;conditions&gt;<br />
&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsFile&#8221;  ignoreCase=&#8221;false&#8221; negate=&#8221;true&#8221; /&gt;<br />
&lt;add input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsDirectory&#8221;  ignoreCase=&#8221;false&#8221; negate=&#8221;true&#8221; /&gt;<br />
&lt;add input=&#8221;{URL}&#8221; pattern=&#8221;^/favicon.ico$&#8221; ignoreCase=&#8221;false&#8221;  negate=&#8221;true&#8221; /&gt;<br />
&lt;/conditions&gt;<br />
&lt;action type=&#8221;Rewrite&#8221; url=&#8221;index.php?q={R:1}&#8221;  appendQueryString=&#8221;true&#8221; /&gt;<br />
&lt;/rule&gt;<br />
&lt;/rules&gt;<br />
&lt;/rewrite&gt;<br />
&lt;defaultDocument&gt;<br />
&lt;files&gt;<br />
&lt;remove value=&#8221;index.php&#8221; /&gt;<br />
&lt;add  value=&#8221;index.php&#8221; /&gt;<br />
&lt;/files&gt;<br />
&lt;/defaultDocument&gt;</p>
<p>&lt;!&#8211; HTTP Errors section  should only be enabled if the &#8220;Error Pages&#8221;<br />
feature has been  delegated as &#8220;Read/Write&#8221; at the Web Server level.<br />
&lt;httpErrors&gt;<br />
&lt;remove statusCode=&#8221;404&#8243;  subStatusCode=&#8221;-1&#8243; /&gt;<br />
&lt;error statusCode=&#8221;404&#8243;  prefixLanguageFilePath=&#8221;" path=&#8221;/index.php&#8221; responseMode=&#8221;ExecuteURL&#8221;  /&gt;<br />
&lt;/httpErrors&gt;<br />
&#8211;&gt;</p>
<p>&lt;/system.webServer&gt;<br />
&lt;/configuration&gt;</p>
</div>
<h4>Default Document</h4>
<p>In the .htaccess file for the sample application, the <em>DirectoryIndex</em> directive tells the Web server which file to load if no filename is  included with the URL.</p>
<div class="code">
<samp># Set the default handler.<br />
DirectoryIndex  index.php</samp>
</div>
<p>For IIS 7, the default document should be set up as high in the Web  site hierarchy as the Module Handler. For example, with PHP, the Module  Handler is usually set at the Web server level. The default document  should be set at that level also, rather than locally within a Web  site’s context. The following code within your Web.config file can  ensure this:</p>
<div class="code">
<samp> &lt;defaultDocument&gt;<br />
&lt;files&gt;<br />
&lt;remove value=&#8221;index.php&#8221; /&gt;<br />
&lt;add value=&#8221;index.php&#8221; /&gt;<br />
&lt;/files&gt;<br />
&lt;/defaultDocument&gt;</samp>
<samp></samp>
</div>
<h4>Error Page Redirects / Handling using .HTACCESS and Web.config</h4>
<p>Some applications handle standard errors within the scope of the   application. The <em>ErrorDocument</em> directive in the .htaccess file of   the sample application tells the Web server to load the home page for   any 404 or “File Not Found” errors.</p>
<div class="code">
<p># Make Application handle   any 404 errors.</p>
<p>ErrorDocument 404 /index.php</p>
</div>
<p>IIS uses the <em>httpErrors</em> directive for this functionality.   However, because the capability to set this at the application level is   turned off by default for IIS, this section should be commented out.</p>
<div class="code">
<p>&lt;!&#8211;   HTTP Errors section should only be enabled if the &#8220;Error Pages&#8221;</p>
<p>feature   has been delegated as &#8220;Read/Write&#8221; at the Web Server level.</p>
<p>&lt;httpErrors&gt;</p>
<p>&lt;remove statusCode=&#8221;404&#8243;   subStatusCode=&#8221;-1&#8243; /&gt;</p>
<p>&lt;error statusCode=&#8221;404&#8243;   prefixLanguageFilePath=&#8221;" path=&#8221;/index.php&#8221; responseMode=&#8221;ExecuteURL&#8221;   /&gt;</p>
<p>&lt;/httpErrors&gt;</p>
<p>&#8211;&gt;</p>
</div>
<h4>URL Rewriting using .HTACCESS and Web.config</h4>
<p>IIS 7 includes the URL Rewrite module. You can use this extension to   provide rules for IIS to rewrite incoming URL requests. The most common   use of URL Rewriting is to provide shorter, easy-to-remember URLs.</p>
<p>Many PHP applications currently ship with rewrite rules as part of   their .htaccess file. These rules tell Apache’s mod_rewrite how and when   to rewrite incoming requests. The IIS 7 URL Rewrite module can read   these rules and translate them into URL Rewrite rules.</p>
<p>For the sample application codes, the relevant mod_rewrite rules in the   .htaccess file are:</p>
<div class="code">
<p>RewriteCond %{HTTP_HOST} ^example\.com$   [NC]</p>
<p>RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]</p>
<p>RewriteCond %{REQUEST_FILENAME} !-f</p>
<p>RewriteCond   %{REQUEST_FILENAME} !-d</p>
<p>RewriteCond %{REQUEST_URI} !=/favicon.ico</p>
<p>RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]</p>
</div>
<p>The IIS URL Rewriter module can read these rules and translate them.   The translated URL Rewriter rules are:</p>
<div class="code">
<p>&lt;rewrite&gt;</p>
<p>&lt;rules&gt;</p>
<p>&lt;rule name=&#8221;Imported Rule 1&#8243;   stopProcessing=&#8221;true&#8221;&gt;</p>
<p>&lt;match url=&#8221;^(.*)$&#8221;   ignoreCase=&#8221;false&#8221; /&gt;</p>
<p>&lt;conditions&gt;</p>
<p>&lt;add   input=&#8221;{HTTP_HOST}&#8221; pattern=&#8221;^example\.com$&#8221; /&gt;</p>
<p>&lt;/conditions&gt;</p>
<p>&lt;action type=&#8221;Redirect&#8221;   redirectType=&#8221;Permanent&#8221; url=&#8221;http://www.example.com/{R:1}&#8221; /&gt;</p>
<p>&lt;/rule&gt;</p>
<p>&lt;rule name=&#8221;Imported Rule 2&#8243;   stopProcessing=&#8221;true&#8221;&gt;</p>
<p>&lt;match url=&#8221;^(.*)$&#8221;   ignoreCase=&#8221;false&#8221; /&gt;</p>
<p>&lt;conditions&gt;</p>
<p>&lt;add   input=&#8221;{REQUEST_FILENAME}&#8221; matchType=&#8221;IsFile&#8221; ignoreCase=&#8221;false&#8221;   negate=&#8221;true&#8221; /&gt;</p>
<p>&lt;add input=&#8221;{REQUEST_FILENAME}&#8221;   matchType=&#8221;IsDirectory&#8221; ignoreCase=&#8221;false&#8221; negate=&#8221;true&#8221; /&gt;</p>
<p>&lt;add input=&#8221;{URL}&#8221; pattern=&#8221;^/favicon.ico$&#8221; ignoreCase=&#8221;false&#8221;   negate=&#8221;true&#8221; /&gt;</p>
<p>&lt;/conditions&gt;</p>
<p>&lt;action   type=&#8221;Rewrite&#8221; url=&#8221;index.php?q={R:1}&#8221; appendQueryString=&#8221;true&#8221; /&gt;</p>
<p>&lt;/rule&gt;</p>
<p>&lt;/rules&gt;</p>
<p>&lt;/rewrite&gt;</p>
</div>
<p>I think this post become very helpful to those peoples who wants to use URL rewriting (SEO friendly URL) in IIS whcih are using PHP.</p>
<p>Feel free to post comment on this post. Thanks You &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.phpgenious.com/2010/04/url-rewriting-with-php-and-iis-7/feed/</wfw:commentRss>
		<slash:comments>18</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! -->