<?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>Everything is Crap &#187; php</title>
	<atom:link href="http://everythingiscrap.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://everythingiscrap.com</link>
	<description>Notes on the crap we&#039;ve been subjected to</description>
	<lastBuildDate>Wed, 11 Jan 2012 21:10:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>If you want to use Sendmail, install it, dummy!</title>
		<link>http://everythingiscrap.com/installing-sendmail/</link>
		<comments>http://everythingiscrap.com/installing-sendmail/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 16:14:46 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[sendmail]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.everythingiscrap.com/?p=667</guid>
		<description><![CDATA[Right&#8230;I must have forgotten to install sendmail, because mail wasn't working for WordPress. First, to verify that sendmail wasn't working I ran this PHP script (thanks to phpeasystep.com) That confirmed it. And the fix was easy: Doing this exposed a flaw in my hosts file and ZYXware.com had the answer sudo gedit /etc/hosts &#8230; 127.0.0.1 [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://everythingiscrap.com/wp-content/uploads/2010/11/Sendmail-Inc.png" alt="" title="Sendmail Inc" width="240" height="35" class="alignnone size-full wp-image-668" /></p>
<p>Right&#8230;I must have forgotten to install sendmail, because mail wasn't working for WordPress. First, to verify that sendmail wasn't working I ran this PHP script (<a href="http://www.phpeasystep.com/phptu/23.html">thanks to phpeasystep.com</a>)</p>
<p><code>&lt;?
// send e-mail to ...
$to=&quot;me@localhost&quot;;

// Your subject
$subject=&quot;Test&quot;;

// From
$header=&quot;from: your name &lt;your email&gt;&quot;;

// Your message
$message=&quot;Hello rn&quot;;
$message.=&quot;This is testrn&quot;;
$message.=&quot;Test again &quot;;

// send email
$sentmail = mail($to,$subject,$message,$header);

// if your email succesfully sent
if($sentmail){
echo &quot;Email Has Been Sent .&quot;;
}
else {
echo &quot;Cannot Send Email &quot;;
}

?&gt;<!--formatted--></code></p>
<p>That confirmed it. And the fix was easy:</p>
<p><code>apt-get install sendmail</code><br />
Doing this exposed a flaw in my hosts file and <a href="http://www.zyxware.com/articles/641/fixed-ubuntu-startup-slows-down-at-starting-mail-transport-agent-mta-sendmail">ZYXware.com had the answer</a></p>
<blockquote><p>
sudo gedit /etc/hosts<br />
&#8230;<br />
127.0.0.1	localhost.localdomain	localhost<br />
127.0.1.1	zyxware01.localdomain zyxware01<br />
&#8230;<br />
If you have a static IP you can replace 127.0.1.1 with your static IP.<br />
&#8230;
</p></blockquote>
<p>So, now mail works from php and, more importantly, WordPress.</p>
<p>[EDIT]<br />
Sheesh&#8230;Ubuntu is picky. Here's (almost) exactly what I have for the top half of my hosts file<br />
<code>127.0.0.1    myhostname    localhost.localdomain    localhost
::1    myhostname    localhost6.localdomain6    localhost6
127.0.1.1    myhostname
192.168.1.100    myhostname.mydomain.com
</code></p>
<p>The spaces are actually tabs, I don't know if it matters. </p>
<p>I also don't know what is needed and what is not, but I mimicked this layout on a new server and it worked; the MTA blah-blah service no longer takes forever and sendmail works nice and quickly.<br />
[/EDIT]</p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/installing-sendmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strip out a bracketed piece of text using PHP</title>
		<link>http://everythingiscrap.com/strip-out-a-bracketed-piece-of-text-using-php/</link>
		<comments>http://everythingiscrap.com/strip-out-a-bracketed-piece-of-text-using-php/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 14:50:02 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regular expressions]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.everythingiscrap.com/?p=641</guid>
		<description><![CDATA[In WordPress I have a free, third-party theme that is displaying my image captions in article excerpts for some reason. The captions show up as a sort of bracketed markup. I tracked down the part of code that prepares the article excerpts and ran this regular expression to strip out any square-bracketed text: The 'Us' [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.everythingiscrap.com/wp-content/uploads/2009/06/120px-php-logo-svg.png" alt="" title="120px-php-logo-svg" width="120" height="64" class="alignleft size-full wp-image-249" /><br />
In WordPress I have a free, third-party theme that is displaying my image captions in article excerpts for some reason. The captions show up as a sort of bracketed markup. I tracked down the part of code that prepares the article excerpts and ran this regular expression to strip out any square-bracketed text:</p>
<p><code>preg_replace(&quot;([.*])Us&quot;, &quot;&quot;, $excerpt)<!--formatted--></code></p>
<p>The 'Us' at the end makes the search Ungreedy (U) and ignores newlines (s).</p>
<p>By the way, I think preg_replace() is one of the worst function names I've come across in a public language/API; but maybe that's just me.</p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/strip-out-a-bracketed-piece-of-text-using-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hrmph, you mean GD wasn&#039;t installed?</title>
		<link>http://everythingiscrap.com/hrmph-you-mean-gd-wasnt-installed/</link>
		<comments>http://everythingiscrap.com/hrmph-you-mean-gd-wasnt-installed/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 14:03:22 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.everythingiscrap.com/?p=590</guid>
		<description><![CDATA[I couldn't embed thumbnail sizes on my new WordPress install on my new Ubuntu server; I could only embed the original size (which was 3072&#215;2048). The options to embed other sizes were just grayed out. It turns out that the default LAMP install doesn't include php-gd, the graphics library that creates thumbnails. Well&#8230; I guess [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://everythingiscrap.com/wp-content/uploads/2010/07/WordPress.jpg" alt="" title="WordPress" width="316" height="73" class="alignnone size-full wp-image-591" /></p>
<p>I couldn't embed thumbnail sizes on my new WordPress install on my new Ubuntu server; I could only embed the original size (which was 3072&#215;2048). The options to embed other sizes were just grayed out. It turns out that the default LAMP install doesn't include php-gd, the graphics library that creates thumbnails. Well&#8230; <a href="http://wordpress.org/support/topic/199390?replies=3">I guess that's easy enough to fix</a>:</p>
<blockquote><p>apt-get install php5-gd</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/hrmph-you-mean-gd-wasnt-installed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weather Underground XML API</title>
		<link>http://everythingiscrap.com/weather-underground-xml-api/</link>
		<comments>http://everythingiscrap.com/weather-underground-xml-api/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 18:00:18 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[weather underground]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.everythingiscrap.com/?p=534</guid>
		<description><![CDATA[Weather Underground has a nice XML API to get at their data, and I recently used it to create a small weather page for my friend's new HTC Hero. This little page turned into a learning exercise for me on both the Weather Underground API and SimpleXMLElement in PHP. SimpleXMLElement: What a great way to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wiki.wunderground.com/index.php/API_-_XML"><img src="http://everythingiscrap.com/wp-content/uploads/2010/06/logo_130x80.png" alt="" title="Weather Underground" width="130" height="80" class="alignnone size-full wp-image-535" /></a></p>
<p>Weather Underground has a nice XML API to get at their data, and I recently used it to create a small weather page for my friend's new HTC Hero. This little page turned into a learning exercise for me on both the Weather Underground API and SimpleXMLElement in PHP.</p>
<p>SimpleXMLElement: What a great way to parse XML! I've been avoiding XML in my code up until now because it's so freaking clunky to implement. But with this I'm eager for the next chance to use XML. I can sum it up in two lines of code (long lines, bear with me):</p>
<p><code>$xml_current_cond = new SimpleXMLElement(file_get_contents(&quot;http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=80301&quot;));
echo $xml_current_cond-&gt;temp_f;<!--formatted--></code></p>
<p>So you see, I read the XML data into $xml_current_cond, and then I access the data through $xml_current_cont->[XML_TAG_NAMES]. It really couldn't be much simpler.</p>
<p>While I'm no fan of the <a href="http://en.wikipedia.org/wiki/Spaghetti_code">spaghetti code</a> that you get from writing PHP, I also realize that <a href="http://www.codinghorror.com/blog/2008/05/php-sucks-but-it-doesnt-matter.html">it doesn't matter</a>. Everyone writes PHP, and SimpleXMLElement is a good example of why they use PHP. </p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/weather-underground-xml-api/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Automated IIS WordPress Installer from Microsoft</title>
		<link>http://everythingiscrap.com/automated-iis-wordpress-installer-from-microsoft/</link>
		<comments>http://everythingiscrap.com/automated-iis-wordpress-installer-from-microsoft/#comments</comments>
		<pubDate>Tue, 15 Jun 2010 15:51:44 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[utilities]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://everythingiscrap.com/?p=477</guid>
		<description><![CDATA[Now that I know how to do it, I'm getting fed up with LAMP as a web platform. I much prefer Windows. (What can I say? I'm a Windows guy!) And I recently stumbled into the Microsoft Web Platform Installer. It makes installing WordPress embarrassingly simple. Just run the installer and it does everything for [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://everythingiscrap.com/wp-content/uploads/2010/06/web.png" alt="" title="web" width="256" height="256" class="alignnone size-full wp-image-478" /></p>
<p>Now that I know how to do it, I'm getting fed up with LAMP as a web platform. I much prefer Windows. (What can I say? I'm a Windows guy!) And I recently stumbled into the <a href="http://www.microsoft.com/web/downloads/platform.aspx">Microsoft Web Platform Installer</a>. It makes installing WordPress embarrassingly simple. Just run the installer and it does <em>everything</em> for you. For instance: I made a website in IIS, then ran the installer and it&#8230;</p>
<ul>
<li>installed PHP,</li>
<li>installed MySQL,</li>
<li>installed WordPress,</li>
<li>and installed a couple other bits and pieces for IIS.</li>
</ul>
<p>From what I understand, it would have installed IIS if it wasn't already installed. And that's not all it installs either: Joomla, Umbraco, phpBB, DotNetNuke, MS SQL Express, and a lot of others. It's great and, more importantly, it <em>works.</em> With the Web Platform Installer I've gone from barely being able to get WordPress to work on Windows/IIS to stupidly simple installs that take about 5 minutes. Literally! It's great!</p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/automated-iis-wordpress-installer-from-microsoft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setup FastCGI on your web server to make PHP sing!</title>
		<link>http://everythingiscrap.com/setup-fastcgi-on-your-web-server-to-make-php-sing/</link>
		<comments>http://everythingiscrap.com/setup-fastcgi-on-your-web-server-to-make-php-sing/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 21:09:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[iis]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[windows server]]></category>

		<guid isPermaLink="false">http://piotrouble.wordpress.com/2009/06/10/setup-fastcgi-on-your-web-server-to-make-php-sing</guid>
		<description><![CDATA[I was setting up the forums for the Pioneer, which are pretty much done, and I noticed that the forums were acting really sluggishly. It's a phpbb3 forum. I've used them before and they've seemed pretty snappy to me, so I figured our webserver, which recently got moved to a server with less resources (but [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-249" title="120px-php-logo-svg" src="http://everythingiscrap.com/wp-content/uploads/2009/06/120px-php-logo-svg.png" alt="" width="120" height="64" /><br />
I was setting up the <a href="http://forums.bigrapidsnews.com/">forums for the Pioneer</a>, which are pretty much done, and I noticed that the forums were acting really sluggishly. It's a phpbb3 forum. I've used them before and they've seemed pretty snappy to me, so I figured our webserver, which recently got moved to a server with less resources (but more hard drive space), was just acting slowly. But I began to wonder if that was really the case. My own pages, written in ASP.net were preforming just fine. So I researched it and apparently there's something called FastCGI that doesn't come pre-installed on 2003, but it greatly increases the response of script interpreters like PHP.</p>
<p>So, I downloaded the <a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;g=6&amp;i=1521">FastCGI extension from Microsoft</a>, installed it, then added this hander for PHP files on the website of interest:</p>
<blockquote><p>C:WINDOWSsystem32inetsrvfcgiext.dll</p></blockquote>
<p>After that I re-ran the PHP installer and told it to use FastCGI. It worked perfectly. Now my phpbb3 is performing much faster, even though the web server still isn't as powerful as it should be. It works; that's all that matters.</p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/setup-fastcgi-on-your-web-server-to-make-php-sing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling PHP5 on IIS6</title>
		<link>http://everythingiscrap.com/enabling-php5-on-iis6/</link>
		<comments>http://everythingiscrap.com/enabling-php5-on-iis6/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 00:28:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[iis]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://piotrouble.wordpress.com/2009/04/08/enabling-php5-on-iis6</guid>
		<description><![CDATA[This is a quick note for me so I don't forget how I did it (if I have to do it again in the future). PHP5 doesn't automatically enable itself on IIS6. You have to do it by hand for each website you create. The first step, and I'm not positive it's necessary, is to [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick note for me so I don't forget how I did it (if I have to do it again in the future).</p>
<p>PHP5 doesn't automatically enable itself on IIS6. You have to do it by hand for each website you create. The first step, and I'm not positive it's necessary, is to create a new Web Service extension and allow it.</p>
<p>Go into IIS, Local Computer, and right click on Web Service Extensions and choose Add new web service extension. After this choose a descriptive name (like PHP x.x.x) and add php-cgi.exe for "Required files." Click OK. Then allow the new service that you created.</p>
<p>Then, on the website of interest, you have to add the application extension for PHP. Right click on the website and choose properties. Navigate to the Home Directory tab and click the Configuration button. From there, under Application Extensions click the Add button and add the .php extension and the php-cgi.exe to the fields listed. Click OK, click OK and that should do it.</p>
<p>Don't forget to add index.php to your list of default documents for the site.</p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/enabling-php5-on-iis6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Notice:</title>
		<link>http://everythingiscrap.com/php-notice/</link>
		<comments>http://everythingiscrap.com/php-notice/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 00:25:00 +0000</pubDate>
		<dc:creator>paul</dc:creator>
				<category><![CDATA[iis]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://piotrouble.wordpress.com/2009/04/08/php-notice</guid>
		<description><![CDATA[I got an error when trying to move one of our old PHP sites to the new server: PHP Notice: Use of undefined constant php &#8211; assumed ‘php’ in&#8230; Basically it means that the php ending tag should be ?&#62; and not php?&#62; Thanks, ClickFire, for the PHP help]]></description>
			<content:encoded><![CDATA[<p>I got an error when trying to move one of our old PHP sites to the new server:</p>
<blockquote><p>PHP Notice: Use of undefined constant php &#8211; assumed ‘php’ in&#8230;</p></blockquote>
<p>Basically it means that the php ending tag should be ?&gt; and not php?&gt;</p>
<p><a href="http://www.clickfire.com/introduction-to-php/">Thanks, ClickFire, for the PHP help</a></p>
]]></content:encoded>
			<wfw:commentRss>http://everythingiscrap.com/php-notice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

