<?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>BenV&#039;s notes &#187; fastcgi</title>
	<atom:link href="http://notes.benv.junerules.com/tag/fastcgi/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.benv.junerules.com</link>
	<description>Rants and notes</description>
	<lastBuildDate>Wed, 28 Jul 2010 13:36:21 +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>FastCGI results</title>
		<link>http://notes.benv.junerules.com/all/software/fastcgi-results/</link>
		<comments>http://notes.benv.junerules.com/all/software/fastcgi-results/#comments</comments>
		<pubDate>Tue, 12 Jan 2010 18:23:19 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[google analytics]]></category>
		<category><![CDATA[magento]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=692</guid>
		<description><![CDATA[A few weeks ago I implemented a FastCGI setup for a magento website. (details Here). That site also runs google analytics. Here&#8217;s what analytics had to show about the speed of the site: Can you guess when FastCGI was enabled? For those of you who are graphically challenged, the above graph shows a loading time [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks ago I implemented a FastCGI setup for a magento website. (details <a href="http://notes.benv.junerules.com/all/software/apache-2-2-and-php-configuration-fun-on-slackware-13/">Here</a>). That site also runs google analytics.<br />
Here&#8217;s what analytics had to show about the speed of the site:<br />
<div id="attachment_693" class="wp-caption alignnone" style="width: 310px"><a href="http://notes.benv.junerules.com/wp-content/uploads/2010/01/fastcgi-graph.png"><img src="http://notes.benv.junerules.com/wp-content/uploads/2010/01/fastcgi-graph-300x58.png" alt="FastCGI speedup graph by Google Analytics" title="FastCGI speedup graph" width="300" height="58" class="size-medium wp-image-693" /></a><p class="wp-caption-text">FastCGI speedup graph</p></div><br />
Can you guess when FastCGI was enabled? <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
For those of you who are graphically challenged, the above graph shows a loading time of 2.1-2.5 seconds on the left and then crashes down to only 1.0-1.3 seconds at the date that I enabled FastCGI. Neat huh? <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Google analytics also notes that &#8220;this site is faster than 83% of the sites&#8221;, whatever that means. Oh well, we&#8217;re happy.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/fastcgi-results/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache 2.2 and PHP configuration fun on Slackware 13</title>
		<link>http://notes.benv.junerules.com/all/software/apache-2-2-and-php-configuration-fun-on-slackware-13/</link>
		<comments>http://notes.benv.junerules.com/all/software/apache-2-2-and-php-configuration-fun-on-slackware-13/#comments</comments>
		<pubDate>Mon, 28 Dec 2009 17:49:30 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[apc]]></category>
		<category><![CDATA[fastcgi]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=669</guid>
		<description><![CDATA[As I love to tinker around with apache/php installations to get them to work as fast as possible while still keeping some security in tact, I found myself messing around with FastCGI today. But why?! Here&#8217;s why: On this machine I previously installed suPhP to get php scripts to run as a normal unix user [...]]]></description>
			<content:encoded><![CDATA[<p>As I love to tinker around with apache/php installations to get them to work as fast as possible while still keeping some security in tact, I found myself messing around with <a href="http://www.fastcgi.com/">FastCGI</a> today. But why?! Here&#8217;s why:<br />
On this machine I previously installed <a href="http://www.suphp.org/">suPhP</a> to get php scripts to run as a normal unix user instead of user apache (so users have the ability to completely lock out their database settings etc for other users on that machine). However, to speed stuff up on a <a href="http://www.magentocommerce.com/">magento</a> webshop I wanted to have a PHP opcode cache running (I tried out <a href="http://pecl.php.net/package/APC">APC</a>).<span id="more-669"></span><br />
Those opcode caches don&#8217;t work very well (read: they only slow things down) if you run php the way it&#8217;s supposed to run under suPHP though, because suPHP needs to be run using php&#8217;s CGI mode. This means no mod_php, but instead starting a new php instance for every request. Not only is this expensive in terms of startup costs, but it also makes those caches completely useless. (since they can&#8217;t share any memory without resorting to state files or some sort of uglyness).</p>
<p>Anyway, suphp is still nice to have for simple sites that don&#8217;t get many hits or don&#8217;t need to be very fast. Therefore I wanted to have both options available. Here&#8217;s how.<br />
I started out with the Slackware packages for php and apache, but soon found both to be inadequate. Php lacked some modules that some site wanted, and apache didn&#8217;t even bring suexec along.<br />
However, the slackware layout is good enough so I altered the slackbuild script a bit and built my own apache. You might need to install some packages as dependencies though. For instance I didn&#8217;t have &#8216;expat&#8217; and &#8216;db44&#8242; installed.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>it:~$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span> ; <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources$ lftp <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.nluug.nl<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>os<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>distr<span style="color: #000000; font-weight: bold;">/</span>slackware<span style="color: #000000; font-weight: bold;">/</span>slackware-<span style="color: #000000;">13.0</span><span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>n<br />
<span style="color: #7a0874; font-weight: bold;">cd</span> ok, <span style="color: #007800;">cwd</span>=<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>os<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>distr<span style="color: #000000; font-weight: bold;">/</span>slackware<span style="color: #000000; font-weight: bold;">/</span>slackware-<span style="color: #000000;">13.0</span><span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>n<br />
lftp ftp.nluug.nl:<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>os<span style="color: #000000; font-weight: bold;">/</span>Linux<span style="color: #000000; font-weight: bold;">/</span>distr<span style="color: #000000; font-weight: bold;">/</span>slackware<span style="color: #000000; font-weight: bold;">/</span>slackware-<span style="color: #000000;">13.0</span><span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>n<span style="color: #000000; font-weight: bold;">&gt;</span> mirror httpd<br />
&nbsp;<span style="color: #666666; font-style: italic;"># takes a while...</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources$ <span style="color: #7a0874; font-weight: bold;">cd</span> httpd<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>httpd$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.apache-mirror.com<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>httpd-2.2.14.tar.bz2<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>httpd$ <span style="color: #c20cb9; font-weight: bold;">vim</span> httpd.SlackBuild</div></div>
<p>Now edit the slackbuild file so it compiles with your compile flags. My changes were:<br />
1. Changed VERSION to 2.2.14 (was 2.2.13)<br />
2. Added these to the configure flags (to enable suexec) around line 103:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #660033;">--enable-suexec</span> \<br />
&nbsp; <span style="color: #660033;">--with-suexec-bin</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>suexec \<br />
&nbsp; <span style="color: #660033;">--with-suexec-docroot</span>=<span style="color: #000000; font-weight: bold;">/</span>www \<br />
&nbsp; <span style="color: #660033;">--with-suexec-caller</span>=apache \<br />
&nbsp; <span style="color: #660033;">--with-suexec-uidmin</span>=<span style="color: #000000;">1000</span> \<br />
&nbsp; <span style="color: #660033;">--with-suexec-gidmin</span>=<span style="color: #000000;">100</span> \<br />
&nbsp; <span style="color: #660033;">--without-suexec-userdir</span> \</div></div>
<p>Compile and install it. Note that the suexec part requires root permissions, so I did this as root.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #666666; font-style: italic;"># bash httpd.SlackBuild</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># takes a while</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #666666; font-style: italic;"># mv /tmp/httpd-2.2.14-i386-1.txz /usr/src/packages</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>sources<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #666666; font-style: italic;"># installpkg /usr/src/packages/httpd-2.2.14-i386-1.txz</span></div></div>
<h3>PHP and suPHP</h3>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>nl3.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>php-5.2.12.tar.bz2<span style="color: #000000; font-weight: bold;">/</span>from<span style="color: #000000; font-weight: bold;">/</span>nl.php.net<span style="color: #000000; font-weight: bold;">/</span>mirror<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Leech leech... and tomorrow there will be a new version since you're compiling it today. That's my luck ;)</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">tar</span> jxf php-5.2.12.tar.bz2<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #7a0874; font-weight: bold;">cd</span> php-5.2.12<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Pick your own configure string, but note that we don't build mod_php, so no --with-apxs!</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>php-5.2.12$ &nbsp;.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-fastcgi</span> <span style="color: #660033;">--enable-force-cgi-redirect</span> <span style="color: #660033;">--with-config-file-path</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">--with-openssl</span> <span style="color: #660033;">--with-zlib</span> <span style="color: #660033;">--enable-bcmath</span> <span style="color: #660033;">--with-bz2</span> <span style="color: #660033;">--enable-calendar</span> <span style="color: #660033;">--with-curl</span> <span style="color: #660033;">--enable-dba</span>=shared <span style="color: #660033;">--enable-exif</span> <span style="color: #660033;">--enable-ftp</span> <span style="color: #660033;">--with-gd</span> <span style="color: #660033;">--with-ttf</span> <span style="color: #660033;">--with-t1lib</span> <span style="color: #660033;">--enable-gd-native-ttf</span> <span style="color: #660033;">--enable-gd-jis-conv</span> <span style="color: #660033;">--with-gettext</span> <span style="color: #660033;">--with-gmp</span> <span style="color: #660033;">--with-imap</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>c-client <span style="color: #660033;">--with-imap-ssl</span> <span style="color: #660033;">--enable-mbstring</span> <span style="color: #660033;">--with-mcrypt</span> <span style="color: #660033;">--with-mhash</span> <span style="color: #660033;">--with-mysql</span> <span style="color: #660033;">--with-mysqli</span> <span style="color: #660033;">--with-ncurses</span> <span style="color: #660033;">--with-pspell</span> <span style="color: #660033;">--with-mm</span> <span style="color: #660033;">--enable-shmop</span> <span style="color: #660033;">--enable-soap</span> <span style="color: #660033;">--enable-sockets</span> <span style="color: #660033;">--enable-sqlite-utf8</span> <span style="color: #660033;">--enable-sysvmsg</span> <span style="color: #660033;">--enable-sysvsem</span> <span style="color: #660033;">--enable-sysvshm</span> <span style="color: #660033;">--with-tidy</span> <span style="color: #660033;">--with-xsl</span> <span style="color: #660033;">--enable-zip</span> <span style="color: #660033;">--with-tsrm-pthreads</span> <span style="color: #660033;">--enable-shared</span> <span style="color: #660033;">--enable-static</span> <span style="color: #660033;">--without-ldap</span> <span style="color: #660033;">--without-ldap-sasl</span> <span style="color: #660033;">--with-jpeg-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-freetype-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-xpm-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-pdo-mysql</span> <span style="color: #660033;">--with-png-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<br />
&nbsp;<span style="color: #666666; font-style: italic;"># barf barf</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>php-5.2.12$ &nbsp;<span style="color: #c20cb9; font-weight: bold;">make</span><br />
&nbsp;<span style="color: #666666; font-style: italic;"># see you tomorrow</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>php-5.2.12$ &nbsp;<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></div></div>
<p>Note that since php is a pleuris product it will ignore the DESTDIR variable that usually works for creating a package. If you want a nice package for php, consider using the slackware build script instead. (I was too lazy for it this time). Next suPHP:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.suphp.org<span style="color: #000000; font-weight: bold;">/</span>download<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1.tar.gz<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zxf suphp-0.7.1.tar.gz<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #7a0874; font-weight: bold;">cd</span> suphp-0.7.1<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-checkpath</span> <span style="color: #660033;">--with-min-uid</span>=<span style="color: #000000;">1000</span> <span style="color: #660033;">--with-apache-user</span>=apache <span style="color: #660033;">--with-logfile</span>=<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>suphp_log <span style="color: #660033;">--with-apr</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>apr-<span style="color: #000000;">1</span>-config<br />
&nbsp;<span style="color: #666666; font-style: italic;"># lala</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">make</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> pkg<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #007800;">DESTDIR</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`/</span>pkg <span style="color: #c20cb9; font-weight: bold;">install</span><br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #7a0874; font-weight: bold;">cd</span> pkg <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> makepkg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1-i386-<span style="color: #000000;">1</span>.tgz<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> installpkg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>packages<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1-i386-<span style="color: #000000;">1</span>.tgz</div></div>
<p>That went smooth. PHP could learn something from this. Now we still need to configure suphp. To do this we create 2 files and alter <span style="color:#FF00FF">httpd.conf</span> a little.<br />
First suphp.conf:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>suphp.conf-example <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>suphp.conf<br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>suphp-0.7.1$ <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>suphp.conf</div></div>
<p>Personally I left most to default, but I did change the log path and the docroot.<br />
Next we need to enable it in apache, but to keep module stuff in their own section we put this in mod_suphp.conf which we include in the httpd.conf.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> mod_suphp.conf<br />
LoadModule suphp_module &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>mod_suphp.so<br />
<span style="color: #666666; font-style: italic;"># AddModule mod_suphp.c</span><br />
AddType application<span style="color: #000000; font-weight: bold;">/</span>x-httpd-php .php<br />
suPHP_AddHandler application<span style="color: #000000; font-weight: bold;">/</span>x-httpd-php<br />
&nbsp;<span style="color: #666666; font-style: italic;"># hit ctrl-d here</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Include /etc/httpd/mod_suphp.conf'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> httpd.conf</div></div>
<p>That should be enough. Now for sites that you want to enable suphp, simply add a few lines to their vhost config like this:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; suPHP_Engine on<br />
&nbsp; &nbsp; &nbsp; &nbsp; suPHP_ConfigPath <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php<br />
&nbsp; &nbsp; &nbsp; &nbsp; suPHP_UserGroup jemoeder <span style="color: #c20cb9; font-weight: bold;">users</span></div></div>
<p>Now you should have a working suPHP installation (provided that you restarted apache etc).<br />
If something fails, check the logs, especially <span style="color:#FFFF00">suphp.log</span> and of course the apache error_log.</p>
<h3>FastCGI</h3>
<p>To get this running I loosely followed <a href="http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/">this blog post</a>. It pretty much worked like Brandon explained, after I recompiled my apache for suexec support that is. Thus a summary:</p>
<h4>Install FastCGI</h4>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.fastcgi.com<span style="color: #000000; font-weight: bold;">/</span>dist<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi-current.tar.gz<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">tar</span> xvf mod_fastcgi-current.tar.gz<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #7a0874; font-weight: bold;">cd</span> mod_fastcgi-2.4.6<br />
benv<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi-2.4.6$ apxs <span style="color: #660033;">-o</span> mod_fastcgi.so <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">*</span>.c<br />
&nbsp;<span style="color: #666666; font-style: italic;"># This as root</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi-2.4.6$ <span style="color: #c20cb9; font-weight: bold;">cp</span> .libs<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi.so <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules<br />
&nbsp;<span style="color: #666666; font-style: italic;"># Now to enable it in apache</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi.conf<br />
LoadModule fastcgi_module <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>mod_fastcgi.so<br />
<br />
FastCgiConfig <span style="color: #660033;">-idle-timeout</span> <span style="color: #000000;">20</span> <span style="color: #660033;">-maxClassProcesses</span> <span style="color: #000000;">1</span><br />
FastCgiWrapper <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>suexec<br />
<span style="color: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #ff0000;">&quot;/cgi-bin/php-fastcgi&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Order Deny,Allow<br />
&nbsp; &nbsp; &nbsp; &nbsp; Deny from All<br />
&nbsp; &nbsp; &nbsp; &nbsp; Allow from <span style="color: #007800;">env</span>=REDIRECT_STATUS<br />
&nbsp; &nbsp; &nbsp; &nbsp; Options ExecCGI<br />
&nbsp; &nbsp; &nbsp; &nbsp; SetHandler fastcgi-script<br />
<span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span><br />
<span style="color: #666666; font-style: italic;"># ctrl-d here</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'Include /etc/httpd/mod_fastcgi.conf'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>httpd<span style="color: #000000; font-weight: bold;">/</span>httpd.conf</div></div>
<p>Now for the magic part, enabling it in a vhost.<br />
First we need a php wrapper script:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>fastcgi-wrappers<span style="color: #000000; font-weight: bold;">/</span>somevhost.com<br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>fastcgi-wrappers<span style="color: #000000; font-weight: bold;">/</span>somevhost.com<span style="color: #000000; font-weight: bold;">/</span>php-fastcgi<br />
<span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PHP_FCGI_CHILDREN</span>=<span style="color: #000000;">5</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PHP_FCGI_MAX_REQUESTS</span>=<span style="color: #000000;">500</span><br />
<span style="color: #7a0874; font-weight: bold;">umask</span> 0022<br />
<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span><br />
<span style="color: #666666; font-style: italic;"># ctrl-d here</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> vhostuser:<span style="color: #c20cb9; font-weight: bold;">users</span> <span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>fastcgi-wrappers<span style="color: #000000; font-weight: bold;">/</span>somevhost.com</div></div>
<p>Note the <span style="color:#00FFFF">-d apc.shm_size=64</span> option. This specific option is to set the cache size for APC, but this way you can give php custom settings per vhost. Neat huh? If you want to give this vhost its own php.ini you can add this to the script:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PHPRC</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>somevhost</div></div>
<p>PHP will check for a php.ini in that dir. Make sure to check the permissions on these dirs though, especially on the wrapper script. Your users might do stuff you don&#8217;t want if you let them alter these things.<br />
Finally to enable FastCGI per vhost, add something to the vhost configuration like this (make sure to disable suphp on that vhost!):</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; SuexecUserGroup jemoeder <span style="color: #c20cb9; font-weight: bold;">users</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; Alias <span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>fastcgi-wrappers<span style="color: #000000; font-weight: bold;">/</span>somevhost.com<span style="color: #000000; font-weight: bold;">/</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; AddHandler php5-fcgi .php<br />
&nbsp; &nbsp; &nbsp; &nbsp; Action php5-fcgi <span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>php-fastcgi</div></div>
<p>Restart apache and you should see stuff like this in the process list:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>$ <span style="color: #c20cb9; font-weight: bold;">ps</span> auwx <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> jemoeder<br />
jemoeder &nbsp;<span style="color: #000000;">5789</span> &nbsp;<span style="color: #000000;">0.1</span> &nbsp;<span style="color: #000000;">4.3</span> <span style="color: #000000;">131388</span> <span style="color: #000000;">44940</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">16</span>:<span style="color: #000000;">46</span> &nbsp; <span style="color: #000000;">0</span>:07 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span><br />
jemoeder &nbsp;<span style="color: #000000;">5790</span> &nbsp;<span style="color: #000000;">0.1</span> &nbsp;<span style="color: #000000;">3.0</span> <span style="color: #000000;">130804</span> <span style="color: #000000;">31888</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">16</span>:<span style="color: #000000;">46</span> &nbsp; <span style="color: #000000;">0</span>:06 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span><br />
jemoeder &nbsp;<span style="color: #000000;">5791</span> &nbsp;<span style="color: #000000;">0.1</span> &nbsp;<span style="color: #000000;">4.3</span> <span style="color: #000000;">131644</span> <span style="color: #000000;">44948</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">16</span>:<span style="color: #000000;">46</span> &nbsp; <span style="color: #000000;">0</span>:06 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span><br />
jemoeder &nbsp;<span style="color: #000000;">5792</span> &nbsp;<span style="color: #000000;">0.1</span> &nbsp;<span style="color: #000000;">3.3</span> <span style="color: #000000;">131620</span> <span style="color: #000000;">34160</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">16</span>:<span style="color: #000000;">46</span> &nbsp; <span style="color: #000000;">0</span>:06 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span><br />
jemoeder &nbsp;<span style="color: #000000;">5793</span> &nbsp;<span style="color: #000000;">0.0</span> &nbsp;<span style="color: #000000;">2.5</span> <span style="color: #000000;">126872</span> <span style="color: #000000;">26672</span> ? &nbsp; &nbsp; &nbsp; &nbsp;S &nbsp; &nbsp;<span style="color: #000000;">16</span>:<span style="color: #000000;">46</span> &nbsp; <span style="color: #000000;">0</span>:05 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>php <span style="color: #660033;">-d</span> apc.shm_size=<span style="color: #000000;">64</span></div></div>
<h3>APC</h3>
<p>Now for some speedup. Let&#8217;s see apachebench on that magento vhost without APC and FastCGI:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>mybrik:~$ ab <span style="color: #660033;">-n</span> <span style="color: #000000;">50</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">3</span> <span style="color: #660033;">-k</span> &nbsp;http:<span style="color: #000000; font-weight: bold;">//</span>www.somevhost.com<span style="color: #000000; font-weight: bold;">/</span><br />
This is ApacheBench, Version <span style="color: #000000;">2.3</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #007800;">$Revision</span>: <span style="color: #000000;">655654</span> $<span style="color: #000000; font-weight: bold;">&gt;</span><br />
Copyright <span style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span style="color: #000000; font-weight: bold;">/</span><br />
Licensed to The Apache Software Foundation, http:<span style="color: #000000; font-weight: bold;">//</span>www.apache.org<span style="color: #000000; font-weight: bold;">/</span><br />
<br />
Benchmarking www.somevhost.com <span style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span style="color: #7a0874; font-weight: bold;">&#41;</span>.....done<br />
<br />
<br />
Server Software: &nbsp; &nbsp; &nbsp; &nbsp;Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.14<br />
Server Hostname: &nbsp; &nbsp; &nbsp; &nbsp;www.somevhost.com<br />
Server Port: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">80</span><br />
<br />
Document Path: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">/</span><br />
Document Length: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">21590</span> bytes<br />
<br />
Concurrency Level: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3</span><br />
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests: &nbsp; <span style="color: #000000;">43.056</span> seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">50</span><br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span><br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">0</span><br />
Keep-Alive requests: &nbsp; &nbsp;<span style="color: #000000;">0</span><br />
Total transferred: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">1104350</span> bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">1079500</span> bytes<br />
Requests per second: &nbsp; &nbsp;<span style="color: #000000;">1.16</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span><br />
Time per request: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">2583.342</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Time per request: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">861.114</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">25.05</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received<br />
<br />
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">10</span> &nbsp; <span style="color: #000000;">12</span> &nbsp; <span style="color: #000000;">3.5</span> &nbsp; &nbsp; <span style="color: #000000;">11</span> &nbsp; &nbsp; &nbsp;<span style="color: #000000;">29</span><br />
Processing: &nbsp;<span style="color: #000000;">2077</span> <span style="color: #000000;">2560</span> <span style="color: #000000;">221.6</span> &nbsp; <span style="color: #000000;">2489</span> &nbsp; &nbsp;<span style="color: #000000;">3083</span><br />
Waiting: &nbsp; &nbsp; <span style="color: #000000;">1741</span> <span style="color: #000000;">2015</span> <span style="color: #000000;">116.6</span> &nbsp; <span style="color: #000000;">2033</span> &nbsp; &nbsp;<span style="color: #000000;">2266</span><br />
Total: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">2093</span> <span style="color: #000000;">2572</span> <span style="color: #000000;">222.5</span> &nbsp; <span style="color: #000000;">2499</span> &nbsp; &nbsp;<span style="color: #000000;">3094</span><br />
<br />
Percentage of the requests served within a certain <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; <span style="color: #000000;">50</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">2499</span><br />
&nbsp; <span style="color: #000000;">66</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">2577</span><br />
&nbsp; <span style="color: #000000;">75</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">2648</span><br />
&nbsp; <span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">2777</span><br />
&nbsp; <span style="color: #000000;">90</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">3002</span><br />
&nbsp; <span style="color: #000000;">95</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">3064</span><br />
&nbsp; <span style="color: #000000;">98</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">3094</span><br />
&nbsp; <span style="color: #000000;">99</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">3094</span><br />
&nbsp;<span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; <span style="color: #000000;">3094</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>As you can see it takes more than a second to get the page to load. Well, 0.8s mean across all, but 2.5s per request.<br />
Let&#8217;s install APC:</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>pecl.php.net<span style="color: #000000; font-weight: bold;">/</span>get<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.19.tgz<br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #c20cb9; font-weight: bold;">tar</span> zvf APC-3.0.19.tgz<br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src$ <span style="color: #7a0874; font-weight: bold;">cd</span> APC-3.0.19<br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.19$ .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-apc</span> <span style="color: #660033;">--enable-apc-filehits</span> <span style="color: #660033;">--enable-apc-sem</span> &nbsp;<span style="color: #660033;">--enable-apc-mmap</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.19$ <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #666666; font-style: italic;"># Or create a package if you're up to it.</span><br />
<span style="color: #666666; font-style: italic;"># Now to enable it in php, assuming php.ini is /etc/php/php.ini</span><br />
root<span style="color: #000000; font-weight: bold;">@</span>it:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>APC-3.0.19$ <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>php<span style="color: #000000; font-weight: bold;">/</span>php.ini<br />
<span style="color: #007800;">extension</span>=<span style="color: #ff0000;">&quot;apc.so&quot;</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>APC<span style="color: #7a0874; font-weight: bold;">&#93;</span> <br />
apc.enabled = <span style="color: #000000;">1</span> <br />
apc.enable_cli = <span style="color: #000000;">1</span><br />
apc.shm_segments = <span style="color: #000000;">1</span> <br />
apc.max_file_size = 10M <br />
apc.stat = <span style="color: #000000;">1</span><br />
<span style="color: #666666; font-style: italic;"># Ctrl-D here</span></div></div>
<p>Restart apache and voila. Time for a new benchmark.</p>
<div class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">benv<span style="color: #000000; font-weight: bold;">@</span>mybrik:~$ ab <span style="color: #660033;">-n</span> <span style="color: #000000;">50</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">3</span> <span style="color: #660033;">-k</span> &nbsp;http:<span style="color: #000000; font-weight: bold;">//</span>www.somevhost.com<span style="color: #000000; font-weight: bold;">/</span><br />
This is ApacheBench, Version <span style="color: #000000;">2.3</span> <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #007800;">$Revision</span>: <span style="color: #000000;">655654</span> $<span style="color: #000000; font-weight: bold;">&gt;</span><br />
Copyright <span style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span style="color: #000000; font-weight: bold;">/</span><br />
Licensed to The Apache Software Foundation, http:<span style="color: #000000; font-weight: bold;">//</span>www.apache.org<span style="color: #000000; font-weight: bold;">/</span><br />
<br />
Benchmarking www.somevhost.com <span style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span style="color: #7a0874; font-weight: bold;">&#41;</span>.....done<br />
<br />
<br />
Server Software: &nbsp; &nbsp; &nbsp; &nbsp;Apache<span style="color: #000000; font-weight: bold;">/</span>2.2.14<br />
Server Hostname: &nbsp; &nbsp; &nbsp; &nbsp;www.somevhost.com<br />
Server Port: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">80</span><br />
<br />
Document Path: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">/</span><br />
Document Length: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">23337</span> bytes<br />
<br />
Concurrency Level: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">3</span><br />
Time taken <span style="color: #000000; font-weight: bold;">for</span> tests: &nbsp; <span style="color: #000000;">10.963</span> seconds<br />
Complete requests: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">50</span><br />
Failed requests: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">0</span><br />
Write errors: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">0</span><br />
Keep-Alive requests: &nbsp; &nbsp;<span style="color: #000000;">0</span><br />
Total transferred: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">1192600</span> bytes<br />
HTML transferred: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">1166850</span> bytes<br />
Requests per second: &nbsp; &nbsp;<span style="color: #000000;">4.56</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)</span><br />
Time per request: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">657.787</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Time per request: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">219.262</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
Transfer rate: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">106.23</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span style="color: #000000; font-weight: bold;">/</span>sec<span style="color: #7a0874; font-weight: bold;">&#93;</span> received<br />
<br />
Connection Times <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; min &nbsp;mean<span style="color: #7a0874; font-weight: bold;">&#91;</span>+<span style="color: #000000; font-weight: bold;">/</span>-sd<span style="color: #7a0874; font-weight: bold;">&#93;</span> median &nbsp; max<br />
Connect: &nbsp; &nbsp; &nbsp; <span style="color: #000000;">10</span> &nbsp; <span style="color: #000000;">22</span> &nbsp;<span style="color: #000000;">15.9</span> &nbsp; &nbsp; <span style="color: #000000;">16</span> &nbsp; &nbsp; &nbsp;<span style="color: #000000;">76</span><br />
Processing: &nbsp; <span style="color: #000000;">477</span> &nbsp;<span style="color: #000000;">630</span> &nbsp;<span style="color: #000000;">71.8</span> &nbsp; &nbsp;<span style="color: #000000;">618</span> &nbsp; &nbsp; <span style="color: #000000;">844</span><br />
Waiting: &nbsp; &nbsp; &nbsp;<span style="color: #000000;">409</span> &nbsp;<span style="color: #000000;">549</span> &nbsp;<span style="color: #000000;">54.4</span> &nbsp; &nbsp;<span style="color: #000000;">551</span> &nbsp; &nbsp; <span style="color: #000000;">708</span><br />
Total: &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">493</span> &nbsp;<span style="color: #000000;">652</span> &nbsp;<span style="color: #000000;">74.8</span> &nbsp; &nbsp;<span style="color: #000000;">640</span> &nbsp; &nbsp; <span style="color: #000000;">858</span><br />
<br />
Percentage of the requests served within a certain <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
&nbsp; <span style="color: #000000;">50</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">640</span><br />
&nbsp; <span style="color: #000000;">66</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">654</span><br />
&nbsp; <span style="color: #000000;">75</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">679</span><br />
&nbsp; <span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">692</span><br />
&nbsp; <span style="color: #000000;">90</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">764</span><br />
&nbsp; <span style="color: #000000;">95</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">811</span><br />
&nbsp; <span style="color: #000000;">98</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">858</span><br />
&nbsp; <span style="color: #000000;">99</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">858</span><br />
&nbsp;<span style="color: #000000;">100</span><span style="color: #000000; font-weight: bold;">%</span> &nbsp; &nbsp;<span style="color: #000000;">858</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>W000t&#8230;. that&#8217;s a lot quicker, almost 4 times as fast. Nice <img src='http://notes.benv.junerules.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/apache-2-2-and-php-configuration-fun-on-slackware-13/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
