<?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>kill the radio &#187; hosts</title>
	<atom:link href="http://blog.killtheradio.net/tag/hosts/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.killtheradio.net</link>
	<description>or die trying</description>
	<lastBuildDate>Thu, 15 Dec 2011 20:21:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Strange problems with hosts resolving in PHP (and some other linux weirdness)</title>
		<link>http://blog.killtheradio.net/technology/strange-problems-with-hosts-resolving-in-php-and-some-other-linux-weirdness/</link>
		<comments>http://blog.killtheradio.net/technology/strange-problems-with-hosts-resolving-in-php-and-some-other-linux-weirdness/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 18:51:31 +0000</pubDate>
		<dc:creator>Andrew Lyon</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[fixes]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[problems]]></category>
		<category><![CDATA[sudo]]></category>

		<guid isPermaLink="false">http://blog.killtheradio.net/?p=565</guid>
		<description><![CDATA[This weekend I wen&#8217;t on a frenzy. I turned beeets.com from a single VPS enterprise to 4 VPSs: 2 web (haproxy, nginx, php-fpm, sphinx, memcached, ndb_mgmd) and 2 database servers (ndmtd). There&#8217;s still some work to do, but the entire setup seems to be functioning well. I had a few problems though. In PHP (just [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I wen&#8217;t on a frenzy. I turned beeets.com from a single VPS enterprise to <a href="http://www.linode.com/?r=15d5d2323910d69794b93ed02cd7d43b2f68d8c5">4 VPSs</a>: 2 web (<a href="http://haproxy.1wt.eu/">haproxy</a>, <a href="http://nginx.org/">nginx</a>, <a href="http://php-fpm.org/">php-fpm</a>, <a href="http://www.sphinxsearch.com/">sphinx</a>, <a href="http://memcached.org/">memcached</a>, <a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster.html">ndb_mgmd</a>) and 2 database servers (<a href="http://dev.mysql.com/doc/refman/5.0/en/mysql-cluster.html">ndmtd</a>). There&#8217;s still some work to do, but the entire setup seems to be functioning well.</p>
<p>I had a few problems though. In PHP (just PHP, and nothing else) hosts were not resolving. The linux OS was resolving hosts just fine, but PHP couldn&#8217;t. It was frustrating. Also, I was unable to sudo. I kept checking permissions on all my files in /etc, rebooting, checking again, etc.</p>
<h2>The fix</h2>
<p>Then I looked again. /etc itself was owned by andrew:users. Huh? I changed permissions back root:root, chmod 755. <em>Everything works</em>. Now some background.</p>
<p>A while back, I wrote some software (bash + php) that makes it insanely easy to install software to several servers at once, and sync configurations for different sets of servers. It&#8217;s called &#8220;ssync.&#8221; It&#8217;s not ready for release yet, but I can say without it, I&#8217;d have about 10% of the work done that I&#8217;d finished already. Ssync is a command-line utility that lets you set up servers (host, internal ip, external ip) and create groups. Each group has a set of install scripts and configuration files that can be synced to /etc. The configuration files are PHP scriptable, so instead of, say, adding all my hosts by hand to the /etc/hosts file, I can just loop over all servers in the group and add them automatically. Same with my www group, I can add a server to the &#8220;www&#8221; group in ssync, and all of a sudden the HAproxy config knows about the server.</p>
<p>Here&#8217;s the problem. When ssync was sending configuration files to /etc on remote servers, it was also setting permissions on those files (and folders) by default. This was because I was using -vaz, which attempts to preserve ownership, groupship, and permissions from the source (not good). I added some new params (so now it&#8217;s &#8220;-vaz &#8211;no-p &#8211;no-g &#8211;no-o&#8221;). Completely fixed it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.killtheradio.net/technology/strange-problems-with-hosts-resolving-in-php-and-some-other-linux-weirdness/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

