<?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>simon r jones &#187; PHP</title>
	<atom:link href="http://www.simonrjones.net/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.simonrjones.net</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2012 00:06:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Checking your Zend Framework route order</title>
		<link>http://www.simonrjones.net/2011/02/checking-your-zend-framework-route-order/</link>
		<comments>http://www.simonrjones.net/2011/02/checking-your-zend-framework-route-order/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 08:39:39 +0000</pubDate>
		<dc:creator>Simon R Jones</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Quick tips]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://www.simonrjones.net/?p=271</guid>
		<description><![CDATA[The order that you create your routes in Zend Framework is important, with the last route defined in your code being matched first. This allows you to set up custom routes and if these aren&#8217;t matched Zend Framework helpfully falls back to the default route which is set up first. If you have a lot [...]]]></description>
			<content:encoded><![CDATA[<p>The order that you create your routes in Zend Framework is important, with the last route defined in your code being matched first. This allows you to set up custom routes and if these aren&#8217;t matched Zend Framework helpfully falls back to the default route which is set up first. If you have a lot of routes though, set up in different places, it can get difficult to verify the order of your routes.</p>
<p>Just use this snippet of code in your controller to return a list of route names set up in your ZF application in the order they are matched via the routing system (i.e. the route at number 1 is matched first, then route 2, etc).</p>
<pre class="brush: php">// Output list of routes, in the order they are matched
echo '&lt;ol&gt;';
$routes = array_reverse($this-&gt;getFrontController()-&gt;getRouter()-&gt;getRoutes());
foreach ($routes as $name =&gt; $route) {
    echo "	&lt;li&gt;$name&lt;/li&gt;\n";
}
echo '&lt;/ol&gt;';</pre>
<p>Find out more about the <a href="http://framework.zend.com/manual/en/zend.controller.router.html">ZF Router</a> at the ZF manual.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonrjones.net/2011/02/checking-your-zend-framework-route-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding the Apache user in PHP</title>
		<link>http://www.simonrjones.net/2009/10/finding-apache-user/</link>
		<comments>http://www.simonrjones.net/2009/10/finding-apache-user/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 22:44:02 +0000</pubDate>
		<dc:creator>Simon R Jones</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Quick tips]]></category>

		<guid isPermaLink="false">http://www.simonrjones.net/?p=41</guid>
		<description><![CDATA[In PHP, knowing what the Apache user is on your webserver is very useful. Anything that writes a file to the server for example sessions, uploading files or other temporary file operations, needs to have the destination folder writeable by Apache. If you&#8217;re developing locally that&#8217;s not usually a problem. But as soon as you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>In PHP, knowing what the Apache user is on your webserver is very useful. Anything that writes a file to the server for example sessions, uploading files or other temporary file operations, needs to have the destination folder writeable by Apache. If you&#8217;re developing locally that&#8217;s not usually a problem. But as soon as you&#8217;re out in the real world file permission issues can sometimes be a pain.</p>
<p>If you&#8217;re having difficulties finding out what the Apache user is try this simple script to help you out.</p>
<p>It basically writes a small temporary file, checks the owner username, gets rid of the file and prints the Apache username to the screen. It should work on PHP4 and PHP5.</p>
<pre class="brush: php">$tmpFilename = tempnam('/tmp', 'TEST');
$handle = fopen($tmpFilename, 'w');
fwrite($handle, 'testdata');
fclose($handle);
$info = posix_getpwuid(fileowner($tmpFilename));
$apacheUser = $info['name'];
unlink($tmpFilename);
echo "The Apache user is $apacheUser";</pre>
<p>There&#8217;s also a small PHP source file you can easily download and use: <a href="/code/getApacheUser.phps">getApacheUser.phps</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.simonrjones.net/2009/10/finding-apache-user/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

