<?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>Joe's Tech Blog &#187; PHP</title>
	<atom:link href="http://www.joestechblog.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joestechblog.com</link>
	<description>IT Support Notes, Tech Culture, Anything Geeky</description>
	<lastBuildDate>Mon, 26 Dec 2011 03:13:52 +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>PHP Headers to use for downloading a dynamically created CSV file</title>
		<link>http://www.joestechblog.com/2011/09/27/php-headers-to-use-for-downloading-a-dynamically-created-csv-file-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-headers-to-use-for-downloading-a-dynamically-created-csv-file-2</link>
		<comments>http://www.joestechblog.com/2011/09/27/php-headers-to-use-for-downloading-a-dynamically-created-csv-file-2/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 16:21:24 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joestechblog.com/?p=132</guid>
		<description><![CDATA[I don&#8217;t always browse the web, but when I do, I prefer Google Chrome (Side-note: If you don&#8217;t get the reference, spend more time on reddit.com). Unfortunately, some people still like using IE. Some code I wrote that worked great on Chrome and Firefox didn&#8217;t cooperate with IE. These headers seemed to work consistently whereas [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t always browse the web, but when I do, I prefer Google Chrome (Side-note: If you don&#8217;t get the reference, spend more time on reddit.com). Unfortunately, some people still like using IE. Some code I wrote that worked great on Chrome and Firefox didn&#8217;t cooperate with IE. These headers seemed to work consistently whereas others (like leaving out the Pragma header) would result in IE throwing a &#8216;Cannot load this site&#8217; error when the Save dialog would open. The <a href="http://stackoverflow.com/questions/2232103/how-do-i-get-csv-file-to-download-on-ie-works-on-firefox">StackOverflow </a>forums have some other references in-case these don&#8217;t work for you.</p>
<pre style="padding-left: 30px;">header("Pragma: public");
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=some_filename.csv");
echo $content;
die();</pre>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.joestechblog.com%2F2011%2F09%2F27%2Fphp-headers-to-use-for-downloading-a-dynamically-created-csv-file-2%2F&amp;t=PHP%20Headers%20to%20use%20for%20downloading%20a%20dynamically%20created%20CSV%20file" id="facebook_share_link_132">Share on Facebook</a>
	<script type="text/javascript">
	<!--
	var button = document.getElementById('facebook_share_link_132') || document.getElementById('facebook_share_icon_132') || document.getElementById('facebook_share_both_132') || document.getElementById('facebook_share_button_132');
	if (button) {
		button.onclick = function(e) {
			var url = this.href.replace(/share\.php/, 'sharer.php');
			window.open(url,'sharer','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	
		if (button.id === 'facebook_share_button_132') {
			button.onmouseover = function(){
				this.style.color='#fff';
				this.style.borderColor = '#295582';
				this.style.backgroundColor = '#3b5998';
			}
			button.onmouseout = function(){
				this.style.color = '#3b5998';
				this.style.borderColor = '#d8dfea';
				this.style.backgroundColor = '#fff';
			}
		}
	}
	-->
	</script>
	]]></content:encoded>
			<wfw:commentRss>http://www.joestechblog.com/2011/09/27/php-headers-to-use-for-downloading-a-dynamically-created-csv-file-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Function to strip everything except numbers from a string</title>
		<link>http://www.joestechblog.com/2011/09/12/php-function-to-strip-everything-except-numbers-from-a-string/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=php-function-to-strip-everything-except-numbers-from-a-string</link>
		<comments>http://www.joestechblog.com/2011/09/12/php-function-to-strip-everything-except-numbers-from-a-string/#comments</comments>
		<pubDate>Mon, 12 Sep 2011 11:58:24 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Tips for IT Pros]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joestechblog.com/?p=114</guid>
		<description><![CDATA[function numeric_only($string) { //function to strip characters other than numerals from a string $numString = ereg_replace("[^[:digit:]]", "", $string); return $numString; } Share on Facebook]]></description>
			<content:encoded><![CDATA[<pre>function numeric_only($string)
	{
    //function to strip characters other than numerals from a string
    $numString = ereg_replace("[^[:digit:]]", "", $string);
    return $numString;
	}</pre>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.joestechblog.com%2F2011%2F09%2F12%2Fphp-function-to-strip-everything-except-numbers-from-a-string%2F&amp;t=PHP%20Function%20to%20strip%20everything%20except%20numbers%20from%20a%20string" id="facebook_share_link_114">Share on Facebook</a>
	<script type="text/javascript">
	<!--
	var button = document.getElementById('facebook_share_link_114') || document.getElementById('facebook_share_icon_114') || document.getElementById('facebook_share_both_114') || document.getElementById('facebook_share_button_114');
	if (button) {
		button.onclick = function(e) {
			var url = this.href.replace(/share\.php/, 'sharer.php');
			window.open(url,'sharer','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	
		if (button.id === 'facebook_share_button_114') {
			button.onmouseover = function(){
				this.style.color='#fff';
				this.style.borderColor = '#295582';
				this.style.backgroundColor = '#3b5998';
			}
			button.onmouseout = function(){
				this.style.color = '#3b5998';
				this.style.borderColor = '#d8dfea';
				this.style.backgroundColor = '#fff';
			}
		}
	}
	-->
	</script>
	]]></content:encoded>
			<wfw:commentRss>http://www.joestechblog.com/2011/09/12/php-function-to-strip-everything-except-numbers-from-a-string/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Escaping special characters in PHP for MSSQL</title>
		<link>http://www.joestechblog.com/2011/09/08/escaping-special-characters-in-php-for-mssql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=escaping-special-characters-in-php-for-mssql</link>
		<comments>http://www.joestechblog.com/2011/09/08/escaping-special-characters-in-php-for-mssql/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 16:00:23 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Tips for IT Pros]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.joestechblog.com/?p=97</guid>
		<description><![CDATA[PHP has a built-in function called mysql_real_escape_string() for use in MySQL queries but MSSQL has been left in the lurch for this one. I found this handy function on the StackOverflow forums that works like a charm (renamed for more uniform convention). function mssql_escape_string($data) {         if ( !isset($data) or empty($data) ) return ''; [...]]]></description>
			<content:encoded><![CDATA[<p>PHP has a built-in function called <a href="http://php.net/mysql_real_escape_string">mysql_real_escape_string()</a> for use in MySQL queries but MSSQL has been left in the lurch for this one. I found this handy function on the <a href="http://stackoverflow.com/questions/574805/how-to-escape-strings-in-mssql-using-php">StackOverflow</a> forums that works like a charm (renamed for more uniform convention).</p>
<pre><code>function mssql_escape_string($data) {
        if ( !isset($data) or empty($data) ) return '';
        if ( is_numeric($data) ) return $data;

        $non_displayables = array(
            '/%0[0-8bcef]/',            // url encoded 00-08, 11, 12, 14, 15
            '/%1[0-9a-f]/',             // url encoded 16-31
            '/[\x00-\x08]/',            // 00-08
            '/\x0b/',                   // 11
            '/\x0c/',                   // 12
            '/[\x0e-\x1f]/'             // 14-31
        );
        foreach ( $non_displayables as $regex )
            $data = preg_replace( $regex, '', $data );
        $data = str_replace("'", "''", $data );
        return $data;
    }</code></pre>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.joestechblog.com%2F2011%2F09%2F08%2Fescaping-special-characters-in-php-for-mssql%2F&amp;t=Escaping%20special%20characters%20in%20PHP%20for%20MSSQL" id="facebook_share_link_97">Share on Facebook</a>
	<script type="text/javascript">
	<!--
	var button = document.getElementById('facebook_share_link_97') || document.getElementById('facebook_share_icon_97') || document.getElementById('facebook_share_both_97') || document.getElementById('facebook_share_button_97');
	if (button) {
		button.onclick = function(e) {
			var url = this.href.replace(/share\.php/, 'sharer.php');
			window.open(url,'sharer','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	
		if (button.id === 'facebook_share_button_97') {
			button.onmouseover = function(){
				this.style.color='#fff';
				this.style.borderColor = '#295582';
				this.style.backgroundColor = '#3b5998';
			}
			button.onmouseout = function(){
				this.style.color = '#3b5998';
				this.style.borderColor = '#d8dfea';
				this.style.backgroundColor = '#fff';
			}
		}
	}
	-->
	</script>
	]]></content:encoded>
			<wfw:commentRss>http://www.joestechblog.com/2011/09/08/escaping-special-characters-in-php-for-mssql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Win2008/IIS7 + PHP5 FastCGI = 404 Error Messages</title>
		<link>http://www.joestechblog.com/2009/11/16/win2008iis7-php5-fastcgi-404-error-messages/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=win2008iis7-php5-fastcgi-404-error-messages</link>
		<comments>http://www.joestechblog.com/2009/11/16/win2008iis7-php5-fastcgi-404-error-messages/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 05:42:26 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[IIS7]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Win2008]]></category>

		<guid isPermaLink="false">http://www.joestechblog.com/?p=35</guid>
		<description><![CDATA[Hopefully this saves someone some time. I spent hours working on a resolution before I came across it. Background: Installed Win2008 + IIS7 + PHP 5.3 using the FastCGI method (used the Windows installer to configure IIS7). Symptoms: PHP worked fine in my Default Site but when attempting to execute any scripts in Virtual Sites [...]]]></description>
			<content:encoded><![CDATA[<p>Hopefully this saves someone some time. I spent hours working on a resolution before I came across it.</p>
<p>Background: Installed Win2008 + IIS7 + PHP 5.3 using the FastCGI method (used the Windows installer to configure IIS7).</p>
<p>Symptoms: PHP worked fine in my Default Site but when attempting to execute any scripts in Virtual Sites or Virtual Directories, every single PHP file would yield a 404 error message.</p>
<p>Solution: The problem ended up being that the &#8216;open_basedir&#8217; config variable from the php config file is applied to ANYWHERE that PHP is run&#8230;regardless of what the actual home folder should be for a site (PHP picks up the basedir during installation and statically enters it in your php.ini file). The default &#8216;basedir&#8217; will be whatever the root of your &#8216;Default Web Site&#8217; in IIS is (usually c:\inetpub\wwwroot\). If you comment out this line (enter a semicolon before the line) and restart IIS, it will solve the problem. If you&#8217;re running PHP as a FastCGI module, you&#8217;ll actually have to rename (or copy) the php.ini file to a file named &#8216;php-cgi-fcgi.ini&#8217; in the same folder as your php-cgi.exe executable. Be sure to restart IIS!</p>
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.joestechblog.com%2F2009%2F11%2F16%2Fwin2008iis7-php5-fastcgi-404-error-messages%2F&amp;t=Win2008%2FIIS7%20%2B%20PHP5%20FastCGI%20%3D%20404%20Error%20Messages" id="facebook_share_link_35">Share on Facebook</a>
	<script type="text/javascript">
	<!--
	var button = document.getElementById('facebook_share_link_35') || document.getElementById('facebook_share_icon_35') || document.getElementById('facebook_share_both_35') || document.getElementById('facebook_share_button_35');
	if (button) {
		button.onclick = function(e) {
			var url = this.href.replace(/share\.php/, 'sharer.php');
			window.open(url,'sharer','toolbar=0,status=0,width=626,height=436');
			return false;
		}
	
		if (button.id === 'facebook_share_button_35') {
			button.onmouseover = function(){
				this.style.color='#fff';
				this.style.borderColor = '#295582';
				this.style.backgroundColor = '#3b5998';
			}
			button.onmouseout = function(){
				this.style.color = '#3b5998';
				this.style.borderColor = '#d8dfea';
				this.style.backgroundColor = '#fff';
			}
		}
	}
	-->
	</script>
	]]></content:encoded>
			<wfw:commentRss>http://www.joestechblog.com/2009/11/16/win2008iis7-php5-fastcgi-404-error-messages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

