<?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; php</title>
	<atom:link href="http://notes.benv.junerules.com/tag/php/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>CMSMadeSimple</title>
		<link>http://notes.benv.junerules.com/all/software/cmsmadesimple/</link>
		<comments>http://notes.benv.junerules.com/all/software/cmsmadesimple/#comments</comments>
		<pubDate>Wed, 14 Jul 2010 10:49:40 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[cmsmadesimple]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[printing]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=831</guid>
		<description><![CDATA[One of our customers has a website with some custom-made CMS made in php. The customer asked us to fix some things, but since I hate touching pleuris-hoeren-product code, especially when the original coder is prutser and has never heard of templates (which is really weird, considering this is a CMS&#8230; maybe it&#8217;s just lazyness&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>One of our customers has a website with some custom-made CMS made in php.<br />
The customer asked us to fix some things, but since I hate touching pleuris-hoeren-product code, especially when the original coder is prutser and has never heard of templates (which is really weird, considering this is a CMS&#8230; maybe it&#8217;s just lazyness&#8230; then again, the <code class="codecolorer text vibrant"><span class="text">echo &quot;&lt;html&gt;blabla\&quot;escaping\&quot;quotes\&quot;is\&quot;so\&quot;much\&quot;fun\n\n\n50 more lines here&quot;;</span></code> style really doesn&#8217;t show much intelligence&#8230;)</p>
<p>Anyway, I figured I might as well move the entire thing to an open CMS project that I&#8217;ve heard some good things about and already implements everything and more that the customer could ever want. That&#8217;s <a href="http://www.cmsmadesimple.org/">CmsMadeSimple</a>.</p>
<p>Converting the old website to the new one was trivially easy. Copy/paste the stylesheet (first mistake), edit the basic template with a menu section, create the pages (copy/paste, copy/paste).<br />
After fixing the html errors that were in the source the page looked like a pixel-perfect copy of the original.<br />
Except for the places where the HTML errors were fixed that is. (the center class now actually worked for instance)</p>
<p>However, when adding the print links I ran into an interesting issue.<br />
Adding print links is also a trivial thing, simply put <code class="codecolorer text vibrant"><span class="text">{print}</span></code> somewhere in the template, and possibly add some options to show an image instead of a text link etc.<br />
However, the links were kinda broken, they gave empty pages. So I figured &#8220;duh, the print template still needs to be fixed&#8221;. However, as soon as I added the <code class="codecolorer text vibrant"><span class="text">{content}</span></code> tag to the template, I got a nice internal server error. WTF.</p>
<p>Checking the logs I could only find nice reports of 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">php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2530</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: segfault at bf04b3f0 ip 08348d32 sp bf04b3f4 error <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">in</span> php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8048000</span>+6e9000<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2564</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: segfault at bf639750 ip 08348d32 sp bf639754 error <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">in</span> php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8048000</span>+6e9000<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2804</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: segfault at bf200230 ip 08348d32 sp bf200234 error <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">in</span> php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8048000</span>+6e9000<span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2896</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: segfault at bf00cbb0 ip 08348d32 sp bf00cbb4 error <span style="color: #000000;">6</span> <span style="color: #000000; font-weight: bold;">in</span> php-cgi<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8048000</span>+6e9000<span style="color: #7a0874; font-weight: bold;">&#93;</span></div></div>
<p>Well&#8230; .I expect nothing less from php. Pleuris-hoere-product. But how the heck&#8230; just because I added content to the print page? What&#8217;s so special about that?</p>
<p>After digging around (enabling logs etc) and enabling <span style="color:#FF00FF">fopen</span> for php (which I had disabled for security), I noticed 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"><span style="color: #7a0874; font-weight: bold;">&#91;</span>Wed Jul <span style="color: #000000;">14</span> <span style="color: #000000;">12</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">29</span> <span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>error<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>client 123.611.204.37<span style="color: #7a0874; font-weight: bold;">&#93;</span> PHP Warning: &nbsp;file_get_contents<span style="color: #7a0874; font-weight: bold;">&#40;</span>http:<span style="color: #000000; font-weight: bold;">//</span>some-site<span style="color: #000000; font-weight: bold;">/</span>oncmsmadesimple<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">&lt;</span>a <span style="color: #007800;">href</span>=<span style="color: #ff0000;">'function.file-get-contents'</span><span style="color: #000000; font-weight: bold;">&gt;</span>function.file-get-contents<span style="color: #000000; font-weight: bold;">&lt;/</span>a<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>: failed to open stream: HTTP request failed<span style="color: #000000; font-weight: bold;">!</span> HTTP<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.1</span> <span style="color: #000000;">401</span> Authorization Required\r, referer: http:<span style="color: #000000; font-weight: bold;">//</span>some-site<span style="color: #000000; font-weight: bold;">/</span>oncmsmadesimple<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #7a0874; font-weight: bold;">&#91;</span>Wed Jul <span style="color: #000000;">14</span> <span style="color: #000000;">12</span>:<span style="color: #000000;">22</span>:<span style="color: #000000;">29</span> <span style="color: #000000;">2010</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>error<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>client 123.611.204.37<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp;<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>some-site<span style="color: #000000; font-weight: bold;">/</span>cmsmadesimple<span style="color: #000000; font-weight: bold;">/</span>modules<span style="color: #000000; font-weight: bold;">/</span>Printing<span style="color: #000000; font-weight: bold;">/</span>Printing.module.php on line <span style="color: #000000;">96</span>, referer: http:<span style="color: #000000; font-weight: bold;">//</span>some-site<span style="color: #000000; font-weight: bold;">/</span>oncmsmadesimple<span style="color: #000000; font-weight: bold;">/</span></div></div>
<p>AHA!. Apparently the printing module fetches the content (or at least, tries to) from the webserver, fails, and then segfaults php. Excellent code guys!<br />
The reason for the failing is obvious from the logs here, I require authentication for the website since this is a test location that shouldn&#8217;t be public. Quick fix, allow the server to skip the login (vhost config):</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: #000000; font-weight: bold;">&lt;</span>Location <span style="color: #000000; font-weight: bold;">/&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; AuthType Basic<br />
&nbsp; &nbsp; &nbsp; &nbsp; AuthName <span style="color: #ff0000;">&quot;Testsite CmsMadeSimple&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>lala<span style="color: #000000; font-weight: bold;">/</span>passwordfile<br />
&nbsp; &nbsp; &nbsp; &nbsp; Require valid-user<br />
&nbsp; &nbsp; &nbsp; &nbsp; Allow from 127.0.0.1<br />
&nbsp; &nbsp; &nbsp; &nbsp; Allow from 192.168.1.1<br />
&nbsp; &nbsp; &nbsp; &nbsp; Satisfy Any<br />
&nbsp; <span style="color: #000000; font-weight: bold;">&lt;/</span>Location<span style="color: #000000; font-weight: bold;">&gt;</span></div></div>
<p>Problem solved. (Hint Printing Module: render your own shit, don&#8217;t cheat with fopen/curl)</p>
<p>Oh yeah: CmsMadeSimple rocks for these simple websites where your customer wants to &#8220;change some texts and add a picture&#8221;. If they can handle word, you can make them handle this (but show them how!).<br />
Give them permissions to add pages and nothing else, write a decent template for them, done.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/cmsmadesimple/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>
		<item>
		<title>PHP &#8211; Produces Horrible Problems</title>
		<link>http://notes.benv.junerules.com/all/software/php-produces-horrible-problems/</link>
		<comments>http://notes.benv.junerules.com/all/software/php-produces-horrible-problems/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 14:11:21 +0000</pubDate>
		<dc:creator>BenV</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[slackware]]></category>

		<guid isPermaLink="false">http://notes.benv.junerules.com/?p=530</guid>
		<description><![CDATA[That IS what it stands for, right? Or maybe the last P is for Programs&#8230;.. oh no, silly me. It&#8217;s for PEOPLE. Now I get it. Anyway, the quote of the day: configure: error: There is something wrong. Please check config.log for more information. Gee, that&#8217;s really&#8230;. helpful. OF COURSE THERE&#8217;S SOMETHING WRONG, I&#8217;M TRYING [...]]]></description>
			<content:encoded><![CDATA[<p>That IS what it stands for, right?<br />
Or maybe the last P is for Programs&#8230;.. oh no, silly me. It&#8217;s for <b>PEOPLE</b>. Now I get it.<br />
Anyway, the quote of the day:</p>
<blockquote><p>configure: error: There is something wrong. Please check config.log for more information.</p></blockquote>
<p><span id="more-530"></span><br />
Gee, that&#8217;s really&#8230;. helpful. <span style="color:#FF0000">OF COURSE THERE&#8217;S SOMETHING WRONG, I&#8217;M TRYING TO INSTALL PHP!!!!</span><br />
But let&#8217;s not get angry yet, I&#8217;m sure it&#8217;ll throw more tantrums at us while we try to chunk it together.<br />
In case you&#8217;re wondering, I&#8217;m trying to configure php so it has curl support. Apparently php&#8217;s configure has decided for me that in order to have curl support, it also requires ldap.</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">configure:<span style="color: #000000;">26607</span>: checking <span style="color: #000000; font-weight: bold;">for</span> curl_easy_perform <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #660033;">-lcurl</span><br />
configure:<span style="color: #000000;">26626</span>: <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #660033;">-o</span> conftest <span style="color: #660033;">-g</span> <span style="color: #660033;">-O2</span> &nbsp; <span style="color: #660033;">-lcurl</span> <span style="color: #660033;">-lidn</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-lldap</span> <span style="color: #660033;">-lrt</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lz</span> conftest.c <span style="color: #660033;">-lcurl</span> &nbsp;<span style="color: #660033;">-lcurl</span> <span style="color: #660033;">-lbz2</span> <span style="color: #660033;">-lz</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-lresolv</span> <span style="color: #660033;">-lm</span> <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lnsl</span> &nbsp;<span style="color: #660033;">-lxm</span><br />
l2 <span style="color: #660033;">-lz</span> <span style="color: #660033;">-lm</span> <span style="color: #660033;">-lcurl</span> <span style="color: #660033;">-lidn</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-lldap</span> <span style="color: #660033;">-lrt</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lz</span> <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">5</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &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>gcc<span style="color: #000000; font-weight: bold;">/</span>i486-slackware-linux<span style="color: #000000; font-weight: bold;">/</span>4.3.3<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>..<span style="color: #000000; font-weight: bold;">/</span>i486-slackware-linux<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ld</span>: cannot <span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-lldap</span><br />
collect2: <span style="color: #c20cb9; font-weight: bold;">ld</span> returned <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">exit</span> status</div></div>
<p>&#8220;<span style="color:#FF0066">Then don&#8217;t configure it with ldap support!</span>&#8221;<br />
I didn&#8217;t. In fact, I explicity told it NOT to support ldap. <span style="color:#FF00FF">&#8211;without-ldap</span>. Doesn&#8217;t matter. Somehow it picked up the requirement to include ldap in the tests. After some searching I found out that the real source for this problem is the <span style="color:#00FFFF">curl-config</span> 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: #666666; font-style: italic;"># /usr/bin/curl-config --libs &nbsp; &nbsp; &nbsp;</span><br />
<span style="color: #660033;">-lcurl</span> <span style="color: #660033;">-lidn</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-lldap</span> <span style="color: #660033;">-lrt</span> <span style="color: #660033;">-lssl</span> <span style="color: #660033;">-lcrypto</span> <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lz</span></div></div>
<p>Note the <span style="color:#FF6600">-lldap</span> there. So basically this is Slackware&#8217;s fault. Meh.</p>
<p><em>Solution 1:</em><br />
 * Get rid of ldap in curl. This involves recompiling curl from source.<br />
<em>Solution 2:</em> Probably the easiest way is to hack curl-config</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: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-ie</span> <span style="color: #ff0000;">'s/-lldap//'</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>curl-config</div></div>
<p><em>Solution 3:</em><br />
 * Install the openldap-client package. However, now you have ldap on your system which you probably don&#8217;t use on a webserver.</p>
<p>I went for solution 1, recompiling it myself from the slackware sources:</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: #666666; font-style: italic;"># cd /usr/src</span><br />
<span style="color: #666666; font-style: italic;"># lftp ftp://ftp.nluug.nl/pub/os/Linux/distr/slackware/slackware-13.0/source/n &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><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 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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 curl<br />
<span style="color: #666666; font-style: italic;"># cd curl</span><br />
<span style="color: #666666; font-style: italic;"># sed -ie 's/configure/configure --disable-ldap --disable-ldaps/' curl.SlackBuild</span><br />
<span style="color: #666666; font-style: italic;"># bash curl.Slackbuild</span></div></div>
<p>After upgrading the curl package with this build it worked for me without the ldap nonsense.</p>
]]></content:encoded>
			<wfw:commentRss>http://notes.benv.junerules.com/all/software/php-produces-horrible-problems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
