<?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>Home of Peter Haza &#187; Ruby / rails</title>
	<atom:link href="http://blog.peterhaza.no/category/programming/ruby-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.peterhaza.no</link>
	<description>Opinions on most things</description>
	<lastBuildDate>Sat, 28 Nov 2009 12:36:06 +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>Phusion Passenger/modrails &#8211; Apache 2&#8230; not found &#8211; Could not find &#8216;apachectl&#8217; or &#8216;apache2ctl&#8217;</title>
		<link>http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/</link>
		<comments>http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 20:23:47 +0000</pubDate>
		<dc:creator>Peter Haza</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby / rails]]></category>

		<guid isPermaLink="false">http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/</guid>
		<description><![CDATA[Yesterday I was going to install Phusion Passenger also known as modrails to have another go at ruby on rails. Earlier I&#8217;ve been using Mongrel as web server, but I&#8217;m not very comfortable with it. But since modrails was released not too long ago, I figured I could give it whirl. The installation instructions were [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I was going to install <a href="http://www.modrails.com/index.html" onclick="pageTracker._trackPageview('/outgoing/www.modrails.com/index.html?referer=');">Phusion Passenger also known as modrails</a> to have another go at ruby on rails. Earlier I&#8217;ve been using Mongrel as web server, but I&#8217;m not very comfortable with it. But since modrails was released not too long ago, I figured I could give it whirl. The installation instructions were so short that I figured it would be a walk in the park.</p>

<p><span id="more-59"></span>
I installed the gem,</p>

<pre><code>sudo gem install passenger
</code></pre>

<p>and everything went just according to the plan. The next step was to run the installation script,</p>

<pre><code>sudo passenger-install-apache2-module
</code></pre>

<p>and I was even greeted with this promising message:</p>

<blockquote>
  <p>This installer will guide you through the entire installation process. It
  shouldn&#8217;t take more than 3 minutes in total.</p>
  
  <p>Here&#8217;s what you can expect from the installation process:</p>
  
  <ol>
  <li>The Apache 2 module will be installed for you.</li>
  <li>You&#8217;ll learn how to configure Apache.</li>
  <li>You&#8217;ll learn how to deploy a Ruby on Rails application.</li>
  </ol>
  
  <p><strong>Don&#8217;t worry if anything goes wrong. This installer will advise you on how to
  solve any problems.</strong></p>
  
  <p>Press Enter to continue, or Ctrl-C to abort.</p>
</blockquote>

<p><a href="#solution">&#8220;Shush you. Just take me to the solution, damn it!&#8221;</a></p>

<h3>Problems</h3>

<p>Ok, so even if something was to go wrong, the installer would help me.</p>

<blockquote>
  <p>Checking for required software&#8230;</p>
  
  <ul>
  <li>GNU C++ compiler&#8230; found at /usr/bin/g++</li>
  <li>Ruby development headers&#8230; found</li>
  <li>OpenSSL support for Ruby&#8230; found</li>
  <li>RubyGems&#8230; found</li>
  <li>Rake&#8230; found at /usr/bin/rake</li>
  <li>Apache 2&#8230; found at /usr/sbin/httpd</li>
  <li>Apache 2 development headers&#8230; found at /usr/sbin/apxs</li>
  <li>Apache Portable Runtime (APR) development headers&#8230; found at /Developer/SDKs/MacOSX10.5.sdk/usr/bin/apr-1-config</li>
  <li>fastthread&#8230; found</li>
  <li>rack&#8230; found  </li>
  </ul>
  
  <p><code>--------------------------------------------</code></p>
  
  <p><code>--------------------------------------------</code></p>
  
  <p>Compiling and installing Apache 2 module&#8230;
  cd /Users/peterhaza/Compile/passenger-2.0.3
  rake clean apache2
  (in /Users/peterhaza/Compile/passenger-2.0.3)
  rake aborted!
  Could not find &#8216;apachectl&#8217; or &#8216;apache2ctl&#8217;.
  /Users/peterhaza/Compile/passenger-2.0.3/rakefile:35
  (See full trace by running task with &#8211;trace)</p>
  
  <p><code>--------------------------------------------</code></p>
  
  <p>It looks like something went wrong</p>
  
  <p>Please read our Users guide for troubleshooting tips:</p>
  
  <p>/Users/peterhaza/Compile/passenger-2.0.3/doc/Users guide.html</p>
  
  <p>If that doesn&#8217;t help, please use our support facilities at:</p>
  
  <p>http://www.modrails.com/</p>
  
  <p>We&#8217;ll do our best to help you.</p>
</blockquote>

<h3>LIES</h3>

<p>Lies, lies and more lies. The installer didn&#8217;t help me, the user guide didn&#8217;t either, and the support facilities cost money. Damn it!</p>

<p>Well, so I set out to fix it myself. <em>which</em> behaved nicely and returned what I expected,</p>

<pre><code>peterhaza@Farquaad passenger-2.0.3$ which apachectl
/usr/local/bin/apachectl
</code></pre>

<p>so it&#8217;s definitely there. I started to scan through the installer script, which was just a nice ruby script, and after trying to add the correct path at the top of the script (where it already adds some stuff to $PATH) and fail, I decided to dig a bit deeper.</p>

<p><a name="solution"></a></p>

<h3>Solution</h3>

<p>In <em>lib/passenger/platform_info.rb</em> I found a method called <code>self.determine_apache2_bindir</code>. It does some fancy look-up stuff, but instead I just told it to return the path where I knew my apachectl was.</p>

<pre><code>def self.determine_apache2_bindir
  "/usr/local/bin"
# if APXS2.nil?
#   return nil
# else
#   return `#{APXS2} -q BINDIR 2&gt;/dev/null`.strip
# end
end
</code></pre>

<p>Voila! After this change, I ran the script again and would you know:</p>

<blockquote>
  <p>Lots of compiling messages…</p>
  
  <p>The Apache 2 module was successfully installed.</p>
  
  <p>Please edit your Apache configuration file, and add these lines:</p>
  
  <p>LoadModule <code>passenger_module /Users/peterhaza/Compile/passenger-2.0.3/ext/apache2/mod_passenger.so</code>
     PassengerRoot /Users/peterhaza/Compile/passenger-2.0.3
     PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby</p>
  
  <p>After you restart Apache, you are ready to deploy any number of Ruby on Rails
  applications on Apache, without any further Ruby on Rails-specific
  configuration!</p>
  
  <p>Press ENTER to continue.</p>
  
  <p>More messages…</p>
</blockquote>

<p>So there you go!</p>


<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center">
<ul class="socials">
		<li class="shr-comfeed">
			<a href="http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/feed" rel="nofollow" class="external" title="Subscribe to the comments for this post?">Subscribe to the comments for this post?</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;title=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+or+%27apache2ctl%27" rel="nofollow" class="external" title="Share this on del.icio.us" onclick="pageTracker._trackPageview('/outgoing/delicious.com/post?url=http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_title=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+or+_27apache2ctl_27&amp;referer=');">Share this on del.icio.us</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;t=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+or+%27apache2ctl%27" rel="nofollow" class="external" title="Share this on Facebook" onclick="pageTracker._trackPageview('/outgoing/www.facebook.com/share.php?v=4_amp_src=bm_amp_u=http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_t=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+or+_27apache2ctl_27&amp;referer=');">Share this on Facebook</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;title=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+or+%27apache2ctl%27" rel="nofollow" class="external" title="Share this on Reddit" onclick="pageTracker._trackPageview('/outgoing/reddit.com/submit?url=http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_title=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+or+_27apache2ctl_27&amp;referer=');">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;title=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+or+%27apache2ctl%27" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon" onclick="pageTracker._trackPageview('/outgoing/www.stumbleupon.com/submit?url=http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_title=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+or+_27apache2ctl_27&amp;referer=');">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+%5B..%5D+-+http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!" onclick="pageTracker._trackPageview('/outgoing/twitter.com/home?status=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+_5B.._5D+-+http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_source=shareaholic&amp;referer=');">Tweet This!</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/&amp;title=Phusion+Passenger%2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+%27apachectl%27+or+%27apache2ctl%27" rel="nofollow" class="external" title="Digg this!" onclick="pageTracker._trackPageview('/outgoing/digg.com/submit?phase=2_amp_url=http_//blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/_amp_title=Phusion+Passenger_2Fmodrails+-+Apache+2...+not+found+-+Could+not+find+_27apachectl_27+or+_27apache2ctl_27&amp;referer=');">Digg this!</a>
		</li>
		<li class="shr-mail">
			<a href="mailto:?subject=%22Phusion%20Passenger%2Fmodrails%20-%20Apache%202...%20not%20found%20-%20Could%20not%20find%20%27apachectl%27%20or%20%27apache2ctl%27%22&amp;body=Link: http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A Yesterday%20I%20was%20going%20to%20install%20%5BPhusion%20Passenger%20also%20known%20as%20modrails%5D%5B1%5D%20to%20have%20another%20go%20at%20ruby%20on%20rails.%20Earlier%20I%27ve%20been%20using%20Mongrel%20as%20web%20server%2C%20but%20I%27m%20not%20very%20comfortable%20with%20it.%20But%20since%20modrails%20was%20released%20not%20too%20long%20ago%2C%20I%20figured%20I%20could%20give%20it%20whirl.%20The%20installation" rel="nofollow" class="external" title="Email this to a friend?">Email this to a friend?</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://blog.peterhaza.no/phusion-passengermodrails-could-not-find-apachectl-or-apache2ctl/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
