<?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>Pelago :: web design &#38; development blog &#187; hostname</title>
	<atom:link href="http://www.pelagodesign.com/blog/tag/hostname/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pelagodesign.com/blog</link>
	<description>Santa Barbara Web Design and Web Development Blog on the web world and other randoms</description>
	<lastBuildDate>Wed, 09 Mar 2011 16:31:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>PHP crons, linux, and the hostname</title>
		<link>http://www.pelagodesign.com/blog/2009/05/28/php-crons-linux-and-the-hostname/</link>
		<comments>http://www.pelagodesign.com/blog/2009/05/28/php-crons-linux-and-the-hostname/#comments</comments>
		<pubDate>Thu, 28 May 2009 18:20:39 +0000</pubDate>
		<dc:creator>John</dc:creator>
				<category><![CDATA[Creative Engineering]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pelagodesign.com/blog/?p=457</guid>
		<description><![CDATA[When running PHP as a cron, the $_SERVER['HOSTNAME'] variable is not set, nor are any other variables that will identify which server your cron is running on. This can be problematic if you are running the same cron on multiple servers, such as in a load balanced environment, and you need the cron to report [...]]]></description>
			<content:encoded><![CDATA[<p>When running PHP as a cron, the $_SERVER['HOSTNAME'] variable is not set, nor are any other variables that will identify which server your cron is running on. This can be problematic if you are running the same cron on multiple servers, such as in a load balanced environment, and you need the cron to report back or log information about the server on which it ran. </p>
<p>Here is some code for getting the hostname value from your linux network configuration, assuming you have setup /etc/sysconfig/network properly.</p>
<p><code><br />
//get hostname info from /etc/sysconfig/network<br />
preg_match('/HOSTNAME=(.*)/', file_get_contents('/etc/sysconfig/network'), $network);<br />
$hostname = split("\=", $network[0]);<br />
echo $hostname[1]; //this equals the value of your HOSTNAME<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pelagodesign.com/blog/2009/05/28/php-crons-linux-and-the-hostname/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

