<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>Small bits of code to start the day.</description><title>Code Breakfast</title><generator>Tumblr (3.0; @codebreakfast)</generator><link>http://jtkendall.com/</link><item><title>Start and Stop Mongrel with PHP</title><description>&lt;p&gt;Recently I was working on building a small application management app for my local server on my MacBook called &lt;a href="http://github.com/jtkendall/lawm"&gt;LAWM&lt;/a&gt; and since I’m learning Ruby on Rails I wanted a quick way to start and stop Mongrel instances. It’s really simple to start and stop Mongrel instances using PHP’s exec() function. You probably wouldn’t want to use this code on a production site and leave it for local servers. With exec() you may have to adjust the ownership or permissions on the project’s folder before this will run correctly.&lt;/p&gt;
&lt;h3&gt;Starting a Mongrel daemon:&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;exec('cd {project_directory} &amp;&amp; mongrel_rails start -d);&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;Stopping a Mongrel daemon:&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;exec('cd {project_directory} &amp;&amp; mongrel_rails stop);&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For more information on PHP’s exec function visit it’s &lt;a href="http://us2.php.net/manual/en/function.exec.php"&gt;PHP manual page.&lt;/a&gt;&lt;/p&gt;</description><link>http://jtkendall.com/post/430316869</link><guid>http://jtkendall.com/post/430316869</guid><pubDate>Sat, 06 Mar 2010 09:58:00 -0500</pubDate><category>Ruby on Rails</category><category>PHP</category><category>Exec()</category><category>Mongrel</category></item></channel></rss>
