<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6571685536547255639</id><updated>2024-10-23T23:56:27.313-07:00</updated><category term="Apache"/><category term="Linux"/><category term="Android"/><category term="Android: Trusting SSL certificates"/><category term="Apache project"/><category term="CentOS"/><category term="Chris J"/><category term="CouchDB"/><category term="Downloadable Books"/><category term="E-Books"/><category term="HTTP persistent connections"/><category term="JSON"/><category term="JSON document"/><category term="KeepAlive"/><category term="KeepAlive Directive"/><category term="KeepAliveTimeout"/><category term="Keystore"/><category term="MaxKeepAliveRequests"/><category term="NoSQL"/><category term="NoSQL database"/><category term="Oracle Enterprise Linux"/><category term="Paul Schaeflein"/><category term="Red Hat"/><category term="openssl"/><title type='text'>BytesForge</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-5704881207751471240</id><published>2015-06-21T23:36:00.002-07:00</published><updated>2015-06-21T23:37:16.379-07:00</updated><title type='text'>Symfony2 design patterns @ symfonyday</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;355&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;//www.slideshare.net/slideshow/embed_code/key/2LRaQfjh8t7Abr&quot; style=&quot;border-width: 1px; border: 1px solid #CCC; margin-bottom: 5px; max-width: 100%;&quot; width=&quot;425&quot;&gt; &lt;/iframe&gt; &lt;br /&gt;
&lt;div style=&quot;margin-bottom: 5px;&quot;&gt;
&lt;strong&gt; &lt;a href=&quot;https://www.slideshare.net/liuggio/design-pattern-symfony2&quot; target=&quot;_blank&quot; title=&quot;Design pattern in Symfony2 - Nanos gigantium humeris insidentes&quot;&gt;Design pattern in Symfony2 - Nanos gigantium humeris insidentes&lt;/a&gt; &lt;/strong&gt; from &lt;strong&gt;&lt;a href=&quot;https://www.slideshare.net/liuggio&quot; target=&quot;_blank&quot;&gt;Giulio De Donato&lt;/a&gt;&lt;/strong&gt; &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Symfony2&amp;nbsp;Framework Complete flow:&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; margin: 0px; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLIE-YyP5DYBlJnl8To3ia7V_SAPIwYe-h2TdiU_7MCvVU8zMonGcn9jqbZf4OyjFw1vE6wX_HxkznWhckYrpy0ibKY7wXYzNG5-R6Pdx9JhwrhIsdIemp4Fq-UUCwQSZn5QIXRM4yvxA/s1600/symfony2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;313&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLIE-YyP5DYBlJnl8To3ia7V_SAPIwYe-h2TdiU_7MCvVU8zMonGcn9jqbZf4OyjFw1vE6wX_HxkznWhckYrpy0ibKY7wXYzNG5-R6Pdx9JhwrhIsdIemp4Fq-UUCwQSZn5QIXRM4yvxA/s400/symfony2.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/5704881207751471240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/5704881207751471240' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5704881207751471240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5704881207751471240'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2015/06/symfony2-design-patterns-symfonyday.html' title='Symfony2 design patterns @ symfonyday'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhLIE-YyP5DYBlJnl8To3ia7V_SAPIwYe-h2TdiU_7MCvVU8zMonGcn9jqbZf4OyjFw1vE6wX_HxkznWhckYrpy0ibKY7wXYzNG5-R6Pdx9JhwrhIsdIemp4Fq-UUCwQSZn5QIXRM4yvxA/s72-c/symfony2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-2861673977967591748</id><published>2012-11-20T07:36:00.000-08:00</published><updated>2012-11-20T07:38:36.349-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Android"/><category scheme="http://www.blogger.com/atom/ns#" term="Android: Trusting SSL certificates"/><category scheme="http://www.blogger.com/atom/ns#" term="Keystore"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="openssl"/><title type='text'>Android: Trusting SSL certificates</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;We use&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Self-signed_certificate&quot; style=&quot;color: #000099; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px; text-decoration: initial;&quot;&gt;a self-signed SSL certificate&lt;/a&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&amp;nbsp;for the test version of our backend web service. Since our certificate isn&#39;t signed by a&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Certificate_authority&quot; style=&quot;color: #000099; font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px; text-decoration: initial;&quot;&gt;CA&lt;/a&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px;&quot;&gt;&amp;nbsp;that Android trusts by default, we need to add our server&#39;s public certificate to our Android app&#39;s trusted store.&lt;/span&gt;&lt;/h2&gt;
&lt;div class=&quot;itemcontent&quot; name=&quot;decodeable&quot; style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 14px; line-height: 18px; overflow: hidden; width: 560px;&quot;&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
These same instructions apply to trusting a custom CA, except you&#39;d get the public certificate directly from the CA instead of from a server.&lt;/div&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
Required tools:&lt;/div&gt;
&lt;ul style=&quot;list-style-image: initial; list-style-position: initial; list-style-type: square; margin: 0px 0px 1em; padding: 0px 0px 0px 1em;&quot;&gt;
&lt;li style=&quot;margin: 0px 0px 0.5em 2.4em; padding: 0px;&quot;&gt;&lt;a href=&quot;http://www.openssl.org/&quot; style=&quot;color: #000099; font-weight: bold; text-decoration: initial;&quot;&gt;OpenSSL&lt;/a&gt;&#39;s command line client&lt;/li&gt;
&lt;li style=&quot;margin: 0px 0px 0.5em 2.4em; padding: 0px;&quot;&gt;&lt;a href=&quot;http://java.sun.com/javase/downloads/index.jsp&quot; style=&quot;color: #000099; font-weight: bold; text-decoration: initial;&quot;&gt;Java SE 6&lt;/a&gt;&amp;nbsp;(for&amp;nbsp;&lt;tt&gt;keytool&lt;/tt&gt;)&lt;/li&gt;
&lt;li style=&quot;margin: 0px 0px 0.5em 2.4em; padding: 0px;&quot;&gt;&lt;a href=&quot;http://www.bouncycastle.org/latest_releases.html&quot; style=&quot;color: #000099; font-weight: bold; text-decoration: initial;&quot;&gt;Bouncy Castle&#39;s provider jar&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
1. Grab the public certificate from the server you want to trust. Replace&amp;nbsp;&lt;tt&gt;${MY_SERVER}&lt;/tt&gt;&amp;nbsp;with your server&#39;s address.&lt;/div&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;echo | openssl s_client -connect ${MY_SERVER}:443 2&amp;gt;&amp;amp;1 | \
 sed -ne &#39;/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p&#39; &amp;gt; mycert.pem
&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
For example, here&#39;s the PEM-encoded public certificate from google.com:&lt;/div&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;-----BEGIN CERTIFICATE-----
MIIDITCCAoqgAwIBAgIQL9+89q6RUm0PmqPfQDQ+mjANBgkqhkiG9w0BAQUFADBM
MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg
THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wOTEyMTgwMDAwMDBaFw0x
MTEyMTgyMzU5NTlaMGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh
MRYwFAYDVQQHFA1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKFApHb29nbGUgSW5jMRcw
FQYDVQQDFA53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkC
gYEA6PmGD5D6htffvXImttdEAoN4c9kCKO+IRTn7EOh8rqk41XXGOOsKFQebg+jN
gtXj9xVoRaELGYW84u+E593y17iYwqG7tcFR39SDAqc9BkJb4SLD3muFXxzW2k6L
05vuuWciKh0R73mkszeK9P4Y/bz5RiNQl/Os/CRGK1w7t0UCAwEAAaOB5zCB5DAM
BgNVHRMBAf8EAjAAMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwudGhhd3Rl
LmNvbS9UaGF3dGVTR0NDQS5jcmwwKAYDVR0lBCEwHwYIKwYBBQUHAwEGCCsGAQUF
BwMCBglghkgBhvhCBAEwcgYIKwYBBQUHAQEEZjBkMCIGCCsGAQUFBzABhhZodHRw
Oi8vb2NzcC50aGF3dGUuY29tMD4GCCsGAQUFBzAChjJodHRwOi8vd3d3LnRoYXd0
ZS5jb20vcmVwb3NpdG9yeS9UaGF3dGVfU0dDX0NBLmNydDANBgkqhkiG9w0BAQUF
AAOBgQCfQ89bxFApsb/isJr/aiEdLRLDLE5a+RLizrmCUi3nHX4adpaQedEkUjh5
u2ONgJd8IyAPkU0Wueru9G2Jysa9zCRo1kNbzipYvzwY4OA8Ys+WAi0oR1A04Se6
z5nRUP8pJcA2NhUzUnC+MY+f6H/nEQyNv4SgQhqAibAxWEEHXw==
-----END CERTIFICATE-----
&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
2. Android has built-in support for the Bouncy Castle keystore format (BKS). Put Bouncy Castle&#39;s jar in your classpath, and create a keystore containing only your trusted key.&lt;/div&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;export CLASSPATH=bcprov-jdk16-145.jar
CERTSTORE=res/raw/mystore.bks
if [ -a $CERTSTORE ]; then
    rm $CERTSTORE || exit 1
fi
keytool \
      -import \
      -v \
      -trustcacerts \
      -alias 0 \
      -file &amp;lt;(openssl x509 -in mycert.pem) \
      -keystore $CERTSTORE \
      -storetype BKS \
      -provider org.bouncycastle.jce.provider.BouncyCastleProvider \
      -providerpath /usr/share/java/bcprov.jar \
      -storepass ez24get
&lt;/pre&gt;
&lt;div style=&quot;margin-bottom: 1em; padding: 0px;&quot;&gt;
3. Create a custom Apache&amp;nbsp;&lt;tt&gt;HttpClient&lt;/tt&gt;&amp;nbsp;that uses your custom store for HTTPS connections.&lt;/div&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;import android.content.Context;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.PlainSocketFactory;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.conn.SingleClientConnManager;

import java.io.InputStream;
import java.security.KeyStore;

public class MyHttpClient extends DefaultHttpClient {

  final Context context;

  public MyHttpClient(Context context) {
    this.context = context;
  }

  @Override protected ClientConnectionManager createClientConnectionManager() {
    SchemeRegistry registry = new SchemeRegistry();
    registry.register(
        new Scheme(&quot;http&quot;, PlainSocketFactory.getSocketFactory(), 80));
    registry.register(new Scheme(&quot;https&quot;, newSslSocketFactory(), 443));
    return new SingleClientConnManager(getParams(), registry);
  }

  private SSLSocketFactory newSslSocketFactory() {
    try {
      KeyStore trusted = KeyStore.getInstance(&quot;BKS&quot;);
      InputStream in = context.getResources().openRawResource(R.raw.mystore);
      try {
        trusted.load(in, &quot;ez24get&quot;.toCharArray());
      } finally {
        in.close();
      }
      return new SSLSocketFactory(trusted);
    } catch (Exception e) {
      throw new AssertionError(e);
    }
  }
}&lt;/pre&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;&lt;/pre&gt;
&lt;pre style=&quot;font-size: 1em; padding: 0px;&quot;&gt;Originally Posted in &amp;nbsp;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 1em;&quot;&gt;&lt;a href=&quot;http://blog.crazybob.org/2010/02/android-trusting-ssl-certificates.html&quot;&gt;crazybob blog&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Helvetica, Arial, sans-serif; font-size: 1em;&quot;&gt; &lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/2861673977967591748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/2861673977967591748' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/2861673977967591748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/2861673977967591748'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2012/11/android-trusting-ssl-certificates.html' title='Android: Trusting SSL certificates'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-8722954169560615402</id><published>2012-11-14T18:52:00.001-08:00</published><updated>2012-11-14T19:14:48.180-08:00</updated><title type='text'>Using Hadoop And PHP</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;post&quot; id=&quot;post-311&quot; style=&quot;display: block; text-align: justify; width: 580px;&quot;&gt;
&lt;h2&gt;
Using Hadoop And PHP&lt;/h2&gt;
&lt;div class=&quot;entry&quot;&gt;
&lt;div id=&quot;post-thumbnail&quot;&gt;
&lt;img alt=&quot;php-icon&quot; class=&quot;attachment-post-thumbnail wp-post-image&quot; height=&quot;64&quot; src=&quot;http://www.godlikemouse.com/wp-content/uploads/2010/12/php-icon.png&quot; title=&quot;php-icon&quot; width=&quot;64&quot; /&gt;&lt;/div&gt;
&lt;h2&gt;
Getting Started&lt;/h2&gt;
So first things first. &amp;nbsp;If you haven’t used Hadoop before you’ll first need to download a Hadoop release and make sure you have Java and PHP installed. &amp;nbsp;To download Hadoop head over to:&lt;br /&gt;
&lt;a href=&quot;http://hadoop.apache.org/common/releases.html&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;http://hadoop.apache.org&#39;]);&quot;&gt;http://hadoop.apache.org/common/releases.html&lt;/a&gt;&lt;br /&gt;
Click on download a release and choose a mirror. &amp;nbsp;I suggest choosing the most recent stable release. &amp;nbsp;Once you’ve downloaded Hadoop, unzip it.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ tar xpf hadoop-0.20.2.tar.gz&lt;/div&gt;
I like to create a symlink to the hadoop-&amp;lt;release&amp;gt; directory to make things easier to manage.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ link -s hadoop-0.20.2 hadoop&lt;/div&gt;
Now you should have everything you need to start creating a Hadoop PHP job.&lt;br /&gt;
&lt;h2&gt;
Creating The Job&lt;/h2&gt;
For this example I’m going to create a simple Map/Reduce job for Hadoop. &amp;nbsp;Let’s start by understanding what we want to happen.&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;We want to read from an input system – this is our mapper&lt;/li&gt;
&lt;li&gt;We want to do something with what we’ve mapped – this is our reducer&lt;/li&gt;
&lt;/ol&gt;
At the root of your development directory, let’s create another directory called script. &amp;nbsp;This is where we’ll store our PHP mapper and reducer files.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ ls&lt;br /&gt;
&lt;br /&gt;
.&lt;br /&gt;
..&lt;br /&gt;
hadoop-0.20.2&lt;br /&gt;
hadoop-0.20.2.tar.gz&lt;br /&gt;
hadoop&lt;/div&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ mkdir script&lt;/div&gt;
Now let’s being creating our mapper script in PHP. &amp;nbsp;Go ahead and create a PHP file called mapper.php under the script directory.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ touch script/mapper.php&lt;/div&gt;
Now let’s look at the basic structure of a PHP mapper.&lt;br /&gt;
&lt;div class=&quot;wp-synhighlighter-outer&quot; id=&quot;wpshdo_1&quot;&gt;
&lt;div class=&quot;wp-synhighlighter-expanded&quot; id=&quot;wpshdt_1&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;wp-synhighlighter-inner&quot; id=&quot;wpshdi_1&quot; style=&quot;display: block;&quot;&gt;
&lt;pre class=&quot;php&quot; style=&quot;font-family: monospace;&quot;&gt;#!/usr/bin/php
&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//this can be anything from reading input from files, to retrieving database content, soap calls, etc.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//for this example I&#39;m going to create a simple php associative array.&lt;/span&gt;
&lt;span class=&quot;re0&quot;&gt;$a&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;
&lt;span class=&quot;st_h&quot;&gt;&#39;first_name&#39;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#39;Hello&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;st_h&quot;&gt;&#39;last_name&#39;&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#39;World&#39;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//it&#39;s important to note that anything you send to STDOUT will be written to the output specified by the mapper.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//it&#39;s also important to note, do not forget to end all output to STDOUT with a PHP_EOL, this will save you a lot of pain.&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;echo&lt;/span&gt; &lt;a href=&quot;http://www.php.net/serialize&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;serialize&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; PHP_EOL&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
So this example is extremely simple. &amp;nbsp;Create a simple associative array and serialize it. &amp;nbsp;Now onto the reducer. &amp;nbsp;Create a PHP file in the script directory called reducer.php.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ touch script/reducer.php&lt;/div&gt;
Now let’s take a look at the layout of a reducer.&lt;br /&gt;
&lt;div class=&quot;wp-synhighlighter-outer&quot; id=&quot;wpshdo_2&quot;&gt;
&lt;div class=&quot;wp-synhighlighter-expanded&quot; id=&quot;wpshdt_2&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;wp-synhighlighter-inner&quot; id=&quot;wpshdi_2&quot; style=&quot;display: block;&quot;&gt;
&lt;pre class=&quot;php&quot; style=&quot;font-family: monospace;&quot;&gt;#!/usr/bin/php
&amp;nbsp;
&lt;span class=&quot;kw2&quot;&gt;&amp;lt;?php&lt;/span&gt;
&amp;nbsp;
&lt;span class=&quot;co1&quot;&gt;//Remember when I said anything put out through STDOUT in our mapper would go to the reducer.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//Well, now we read from the STDIN to get the result of our mapper.&lt;/span&gt;
&lt;span class=&quot;co1&quot;&gt;//iterate all lines of output from our mapper&lt;/span&gt;
&lt;span class=&quot;kw1&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$line&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/fgets&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;fgets&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;STDIN&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;!==&lt;/span&gt; &lt;span class=&quot;kw4&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;br0&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//remove leading and trailing whitespace, just in case  &lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$line&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/trim&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$line&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//now recreate the array we serialized in our mapper&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$a&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/unserialize&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;unserialize&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$line&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//Now, we do whatever we need to with the data.  Write it out again so another process can pick it up,&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//send it to the database, soap call, whatever.  In this example, just change it a little and&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//write it back out.&lt;/span&gt;
    &lt;span class=&quot;re0&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;st_h&quot;&gt;&#39;middle_name&#39;&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;sy0&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;st_h&quot;&gt;&#39;Jason&#39;&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;co1&quot;&gt;//do not forget the PHP_EOL&lt;/span&gt;
    &lt;span class=&quot;kw1&quot;&gt;echo&lt;/span&gt; &lt;a href=&quot;http://www.php.net/serialize&quot; onclick=&quot;javascript:_gaq.push([&#39;_trackEvent&#39;,&#39;outbound-article&#39;,&#39;www.php.net&#39;]);&quot;&gt;&lt;span class=&quot;kw3&quot;&gt;serialize&lt;/span&gt;&lt;/a&gt;&lt;span class=&quot;br0&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;re0&quot;&gt;$a&lt;/span&gt;&lt;span class=&quot;br0&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;sy0&quot;&gt;,&lt;/span&gt; PHP_EOL&lt;span class=&quot;sy0&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;br0&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;co1&quot;&gt;//end while&lt;/span&gt;
&lt;span class=&quot;sy1&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
So now we have a very simple mapper and reducer ready to go.&lt;br /&gt;
&lt;h2&gt;
Execution&lt;/h2&gt;
So now let’s run it and see what happens. &amp;nbsp;But first, a little prep work. &amp;nbsp;We need to specify the input directory that will be used when the job runs.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ mkdir input&lt;/div&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ touch input/conf&lt;/div&gt;
Ok, that was difficult. &amp;nbsp;We have an input directory and we’ve created an empty conf file. &amp;nbsp;The empty conf file is just something that the mapper will use to get started. &amp;nbsp;For now, don’t worry about it. &amp;nbsp;Now let’s run this bad boy. &amp;nbsp;Make sure you have your JAVA_HOME set, this is usually in the /usr directory. &amp;nbsp;You can set this by running #export JAVA_HOME=/usr.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ hadoop/bin/hadoop jar hadoop/contrib/streaming/hadoop-0.20.2-streaming.jar -mapper script/mapper.php -reducer script/reducer.php -input input/* -output output&lt;/div&gt;
So here’s what the command does. &amp;nbsp;The first part executes the hadoop execute script. &amp;nbsp;The “jar” argument tells hadoop to use a jar, in this case it tells it to use “hadoop/contrib/streaming/hadoop-0.20.2-streaming.jar”. &amp;nbsp;Next we pass the mapper and reducer arguments to the job and specify input and output directories. &amp;nbsp;If we wanted to, we could pass configuration information to the mapper, or files, etc. &amp;nbsp;We would just use the same line read structure that we used in the reducer to get the information. &amp;nbsp;That’s what would go in the input directory if we needed it to. &amp;nbsp;But for this example, we’ll just pass nothing. &amp;nbsp;Next the output directory will contain the output of our reducer. &amp;nbsp;In this case if everything works out correct, it will contain the PHP serialized form of our modified $a array. &amp;nbsp;If all goes well you should see something like this:&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ hadoop/bin/hadoop jar hadoop/contrib/streaming/hadoop-0.20.2-streaming.jar -mapper script/mapper.php -reducer script/reducer.php -input input/* -output output&lt;br /&gt;
&lt;br /&gt;
10/12/10 12:53:56 INFO jvm.JvmMetrics: Initializing JVM Metrics with processName=JobTracker, sessionId=&lt;br /&gt;
10/12/10 12:53:56 WARN mapred.JobClient: No job jar file set. &amp;nbsp;User classes may not be found. See JobConf(Class) or JobConf#setJar(String).&lt;br /&gt;
10/12/10 12:53:56 INFO mapred.FileInputFormat: Total input paths to process : 1&lt;br /&gt;
10/12/10 12:53:56 INFO streaming.StreamJob: getLocalDirs(): [/tmp/hadoop-root/mapred/local]&lt;br /&gt;
10/12/10 12:53:56 INFO streaming.StreamJob: Running job: job_local_0001&lt;br /&gt;
10/12/10 12:53:56 INFO streaming.StreamJob: Job running in-process (local Hadoop)&lt;br /&gt;
10/12/10 12:53:56 INFO mapred.FileInputFormat: Total input paths to process : 1&lt;br /&gt;
10/12/10 12:53:56 INFO mapred.MapTask: numReduceTasks: 1&lt;br /&gt;
10/12/10 12:53:56 INFO mapred.MapTask: io.sort.mb = 100&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.MapTask: data buffer = 79691776/99614720&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.MapTask: record buffer = 262144/327680&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: PipeMapRed exec [/root/./script/mapper.php]&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: MRErrorThread done&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: Records R/W=0/1&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: MROutputThread done&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: mapRedFinished&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.MapTask: Starting flush of map output&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.MapTask: Finished spill 0&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.TaskRunner: Task:attempt_local_0001_m_000000_0 is done. And is in the process of commiting&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.LocalJobRunner: Records R/W=0/1&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.TaskRunner: Task &#39;attempt_local_0001_m_000000_0&#39; done.&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.LocalJobRunner:&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.Merger: Merging 1 sorted segments&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.Merger: Down to the last merge-pass, with 1 segments left of total size: 70 bytes&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.LocalJobRunner:&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: PipeMapRed exec [/root/./script/reducer.php]&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: R/W/S=1/0/0 in:NA [rec/s] out:NA [rec/s]&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: Records R/W=1/1&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: MROutputThread done&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: MRErrorThread done&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.PipeMapRed: mapRedFinished&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.TaskRunner: Task:attempt_local_0001_r_000000_0 is done. And is in the process of commiting&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.LocalJobRunner:&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.TaskRunner: Task attempt_local_0001_r_000000_0 is allowed to commit now&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.FileOutputCommitter: Saved output of task &#39;attempt_local_0001_r_000000_0&#39; to file:/root/output&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.LocalJobRunner: Records R/W=1/1 &amp;gt; reduce&lt;br /&gt;
10/12/10 12:53:57 INFO mapred.TaskRunner: Task &#39;attempt_local_0001_r_000000_0&#39; done.&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.StreamJob: &amp;nbsp;map 100% &amp;nbsp;reduce 100%&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.StreamJob: Job complete: job_local_0001&lt;br /&gt;
10/12/10 12:53:57 INFO streaming.StreamJob: Output: output&lt;/div&gt;
If you get errors where it’s complaining about the output directory, just remove the output directory and try again.&lt;br /&gt;
&lt;h2&gt;
Result&lt;/h2&gt;
Once you’ve got something similar to the above and no errors, we can check out the result.&lt;br /&gt;
&lt;div class=&quot;wp-terminal&quot;&gt;
user@computer:$ cat output/*&lt;br /&gt;
&lt;br /&gt;
a:3:{s:10:&quot;first_name&quot;;s:5:&quot;Hello&quot;;s:9:&quot;last_name&quot;;s:5:&quot;World&quot;;s:11:&quot;middle_name&quot;;s:5:&quot;Jason&quot;;}&lt;/div&gt;
There we go, a serialized form of our modified PHP array $a. &amp;nbsp;That’s all there is to it. &amp;nbsp;Now, go forth and Hadoop.&lt;br /&gt;
&lt;div class=&quot;shareinpost&quot;&gt;
&lt;div class=&quot;clean&quot;&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/8722954169560615402/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/8722954169560615402' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/8722954169560615402'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/8722954169560615402'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2012/11/using-hadoop-and-php.html' title='Using Hadoop And PHP'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-522879547874620594</id><published>2012-11-04T21:45:00.003-08:00</published><updated>2012-11-04T21:53:56.921-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Chris J"/><category scheme="http://www.blogger.com/atom/ns#" term="Downloadable Books"/><category scheme="http://www.blogger.com/atom/ns#" term="E-Books"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><title type='text'>Downloadable books</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;h3 class=&quot;groups title&quot; style=&quot;border: 0px; color: #333333; font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 16px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;/h3&gt;
&lt;h4 style=&quot;background-color: white; border: 0px; font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 15px; font-weight: inherit; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;a href=&quot;http://www.linkedin.com/profile/view?id=5619593&amp;amp;authType=name&amp;amp;authToken=_NQN&amp;amp;goback=%2Eamf_43875_5619593&amp;amp;trk=anetppl_profil&quot; style=&quot;border: 0px; color: black; font-family: inherit; font-style: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;&quot;&gt;Chris J&lt;/a&gt;&amp;nbsp;&lt;span style=&quot;background-color: transparent; font-size: 13px;&quot;&gt;&amp;nbsp;started a page of links to various books available for download in PDF format. The page contains direct links to the books, without going through a data-harvesting site, as is so often posted here.&lt;/span&gt;&lt;/h4&gt;
&lt;div class=&quot;summary&quot; style=&quot;border: 0px; font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 13px; outline: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.linkedin.com/redirect?url=http%3A%2F%2Fcfajohnson%2Ecom%2Fcomputers%2Fpdflinks%2Eshtml&amp;amp;urlhash=ArDp&amp;amp;_t=tracking_anet&quot; rel=&quot;nofollow&quot; style=&quot;border: 0px; color: #006699; font-family: inherit; font-style: inherit; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;blank&quot;&gt;http://cfajohnson.com/computers/pdflinks.shtml&lt;/a&gt;&lt;br /&gt;
&lt;h3 class=&quot;desc&quot; style=&quot;background-color: white; clear: left; color: #444444; font-family: &#39;Trebuchet MS&#39;, helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 20px;&quot;&gt;
&quot;&lt;span class=&quot;desctitle&quot; style=&quot;font-weight: bold;&quot;&gt;Self-Service Linux®: Mastering the Art of Problem Determination - Free 456 Page eBook&lt;/span&gt;&quot;&lt;/h3&gt;
&lt;h3 class=&quot;desc&quot; style=&quot;background-color: white; clear: left; color: #444444; font-family: &#39;Trebuchet MS&#39;, helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 20px;&quot;&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 13px; line-height: 15px;&quot;&gt;Get the book directly, without going through a data-harvesting site:&lt;/span&gt;&lt;a href=&quot;http://www.linkedin.com/redirect?url=http%3A%2F%2Fwww%2Einformit%2Ecom%2Fcontent%2Fimages%2F013147751X%2Fdownloads%2F013147751X_book%2Epdf&amp;amp;urlhash=HXgc&amp;amp;_t=tracking_disc&quot; rel=&quot;nofollow&quot; style=&quot;border: 0px; color: #006699; font-family: Arial, Helvetica, &#39;Nimbus Sans L&#39;, sans-serif; font-size: 13px; line-height: 15px; margin: 0px; outline: none; padding: 0px; text-decoration: none; vertical-align: baseline;&quot; target=&quot;blank&quot;&gt;http://www.informit.com/content/images/013147751X/downloads/013147751X_book.pdf&lt;/a&gt;&lt;/h3&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/522879547874620594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/522879547874620594' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/522879547874620594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/522879547874620594'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2012/11/downloadable-books.html' title='Downloadable books'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-7466324454376487251</id><published>2012-06-19T20:35:00.001-07:00</published><updated>2012-06-19T20:40:05.162-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="HTTP persistent connections"/><category scheme="http://www.blogger.com/atom/ns#" term="KeepAlive"/><category scheme="http://www.blogger.com/atom/ns#" term="KeepAlive Directive"/><category scheme="http://www.blogger.com/atom/ns#" term="KeepAliveTimeout"/><category scheme="http://www.blogger.com/atom/ns#" term="MaxKeepAliveRequests"/><title type='text'>HOWTO Set KeepAlive in Apache HTTPd</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px;&quot;&gt;To set keep=alive parameters in Apache2&amp;nbsp; Httpd, you need to pay attention to 3 directives:&lt;/span&gt;&lt;br /&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;




&lt;/h2&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;


&lt;/h2&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







KeepAlive&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







KeepAliveTimeout&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







MaxKeepAliveRequests&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







KeepAlive&amp;nbsp;Directive&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; class=&quot;directive&quot; style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; text-align: left;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Description:&lt;/th&gt;&lt;td&gt;Enables HTTP persistent connections&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Syntax:&lt;/th&gt;&lt;td&gt;&lt;code&gt;KeepAlive On|Off&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Default:&lt;/th&gt;&lt;td&gt;&lt;code&gt;KeepAlive On&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Context:&lt;/th&gt;&lt;td&gt;server config, virtual host&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Status:&lt;/th&gt;&lt;td&gt;Core&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Module:&lt;/th&gt;&lt;td&gt;core&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
&lt;br /&gt;
The Keep-Alive extension to HTTP/1.0 and the persistent connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over the same TCP connection. In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images. To enable Keep-Alive connections, set&amp;nbsp;&lt;code&gt;KeepAlive On&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
For HTTP/1.0 clients, Keep-Alive connections will only be used if they are specifically requested by a client. In addition, a Keep-Alive connection with an HTTP/1.0 client can only be used when the length of the content is known in advance. This implies that dynamic content such as CGI output, SSI pages, and server-generated directory listings will generally not use Keep-Alive connections to HTTP/1.0 clients. For HTTP/1.1 clients, persistent connections are the default unless otherwise specified. If the client requests it, chunked encoding will be used in order to send content of unknown length over persistent connections.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
When a client uses a Keep-Alive connection it will be counted as a single &quot;request&quot; for the MaxRequestsPerChild directive, regardless of how many requests are sent using the connection.&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;directive-section&quot;&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







KeepAliveTimeout&amp;nbsp;Directive&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; class=&quot;directive&quot; style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Description:&lt;/th&gt;&lt;td&gt;Amount of time the server will wait for subsequent requests on a persistent connection&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Syntax:&lt;/th&gt;&lt;td&gt;&lt;code&gt;KeepAliveTimeout&amp;nbsp;&lt;var&gt;seconds&lt;/var&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Default:&lt;/th&gt;&lt;td&gt;&lt;code&gt;KeepAliveTimeout 5&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Context:&lt;/th&gt;&lt;td&gt;server config, virtual host&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Status:&lt;/th&gt;&lt;td&gt;Core&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Module:&lt;/th&gt;&lt;td&gt;core&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
&lt;br /&gt;
The number of seconds Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the&amp;nbsp;&lt;code class=&quot;directive&quot;&gt;Timeout&lt;/code&gt;&amp;nbsp;directive applies.&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
Setting&amp;nbsp;&lt;code class=&quot;directive&quot;&gt;KeepAliveTimeout&lt;/code&gt;&amp;nbsp;to a high value may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
In a name-based virtual host context, the value of the first defined virtual host (the default host) in a set of&amp;nbsp;&lt;code class=&quot;directive&quot;&gt;NameVirtualHost&lt;/code&gt;&amp;nbsp;will be used. The other values will be ignored.&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;directive-section&quot;&gt;
&lt;h2 style=&quot;color: #333333; font-family: Arial, Helvetica, sans-serif; font-size: 1.4em; font-weight: normal; line-height: 15px; padding: 0px; vertical-align: bottom; width: 540px;&quot;&gt;







MaxKeepAliveRequests&amp;nbsp;Directive&lt;/h2&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;table border=&quot;1&quot; class=&quot;directive&quot; style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;th&gt;Description:&lt;/th&gt;&lt;td&gt;Number of requests allowed on a persistent connection&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Syntax:&lt;/th&gt;&lt;td&gt;&lt;code&gt;MaxKeepAliveRequests&amp;nbsp;&lt;var&gt;number&lt;/var&gt;&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Default:&lt;/th&gt;&lt;td&gt;&lt;code&gt;MaxKeepAliveRequests 100&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Context:&lt;/th&gt;&lt;td&gt;server config, virtual host&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Status:&lt;/th&gt;&lt;td&gt;Core&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;th&gt;Module:&lt;/th&gt;&lt;td&gt;core&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
&lt;br /&gt;
The&amp;nbsp;&lt;code class=&quot;directive&quot;&gt;MaxKeepAliveRequests&lt;/code&gt;&amp;nbsp;directive limits the number of requests allowed per connection when&lt;code class=&quot;directive&quot;&gt;KeepAlive&lt;/code&gt;&amp;nbsp;is on. If it is set to&amp;nbsp;&lt;code&gt;0&lt;/code&gt;, unlimited requests will be allowed. We recommend that this setting be kept to a high value for maximum server performance.&lt;/div&gt;
&lt;div style=&quot;color: #333333; font-family: Helvetica, Arial, sans-serif; font-size: 12px; line-height: 15px; margin-bottom: 5px;&quot;&gt;
For example:&lt;/div&gt;
&lt;div style=&quot;height: auto; overflow: hidden; width: inherit;&quot;&gt;
&lt;div class=&quot;syntaxhighlighter &quot; id=&quot;highlighter_460851&quot; style=&quot;background-color: rgb(231, 229, 220) !important; background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 1em 0px !important; outline: 0px !important; padding: 1px !important; position: relative !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: 540px;&quot;&gt;
&lt;div class=&quot;lines&quot; style=&quot;background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;div class=&quot;line alt1&quot; style=&quot;background-image: none !important; border: 0px !important; bottom: auto !important; float: none !important; height: auto !important; left: auto !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;
&lt;span class=&quot;content&quot; style=&quot;background-color: rgb(255, 255, 255) !important; background-image: none !important; border-left-color: rgb(108, 226, 108) !important; border-left-style: solid !important; border-width: 0px 0px 0px 3px !important; bottom: auto !important; color: black; display: block !important; float: none !important; font-family: Consolas, Monaco, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px 0px 0px 3.3em !important; outline: 0px !important; padding: 0px 0px 0px 0.5em !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&lt;span class=&quot;block&quot; style=&quot;background-image: url(http://www.smartsoftwarebits.com/plugins/content/codecitation/styles/wrapping.png) !important; background-position: 0px 1.1em !important; background-repeat: no-repeat no-repeat !important; border: 0px !important; bottom: auto !important; display: block !important; float: none !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px 0px 0px 1.5em !important; position: static !important; right: auto !important; text-indent: -1.5em !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&lt;code class=&quot;plain&quot; style=&quot;background-image: none !important; border: 0px !important; bottom: auto !important; display: inline !important; float: none !important; font-family: Consolas, Monaco, &#39;Bitstream Vera Sans Mono&#39;, &#39;Courier New&#39;, Courier, monospace !important; font-size: 1em !important; height: auto !important; left: auto !important; line-height: 1.1em !important; margin: 0px !important; outline: 0px !important; padding: 0px !important; position: static !important; right: auto !important; top: auto !important; vertical-align: baseline !important; width: auto !important;&quot;&gt;&lt;code&gt;MaxKeepAliveRequests 500&lt;/code&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/7466324454376487251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/7466324454376487251' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/7466324454376487251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/7466324454376487251'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2012/06/howto-set-keepalive-in-apache-httpd.html' title='HOWTO Set KeepAlive in Apache HTTPd'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-4029065273946930253</id><published>2012-06-17T22:07:00.000-07:00</published><updated>2012-06-17T22:07:15.009-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Apache"/><category scheme="http://www.blogger.com/atom/ns#" term="Apache project"/><category scheme="http://www.blogger.com/atom/ns#" term="CentOS"/><category scheme="http://www.blogger.com/atom/ns#" term="CouchDB"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON"/><category scheme="http://www.blogger.com/atom/ns#" term="JSON document"/><category scheme="http://www.blogger.com/atom/ns#" term="NoSQL"/><category scheme="http://www.blogger.com/atom/ns#" term="NoSQL database"/><category scheme="http://www.blogger.com/atom/ns#" term="Oracle Enterprise Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Red Hat"/><title type='text'>How to Install Apache CouchDB on CentOS 6 (from Source and EPEL)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;CouchDB is an Apache project.&lt;/b&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEzjb6WsbxopA-dLYXJXvSaRkKrgtLhYsfC6XDVfPhQ94IzPw4nRpA74DpDXVdX6K0XWJN-tWOWtLfEvHUJ6I3yILcyieB0USY-4b0F8i6xER2kwuBv7mo8LX-1cG8ZlfpmeC0Ud4C5nQ/s1600/couchdb-logo.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; float: right; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEzjb6WsbxopA-dLYXJXvSaRkKrgtLhYsfC6XDVfPhQ94IzPw4nRpA74DpDXVdX6K0XWJN-tWOWtLfEvHUJ6I3yILcyieB0USY-4b0F8i6xER2kwuBv7mo8LX-1cG8ZlfpmeC0Ud4C5nQ/s1600/couchdb-logo.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Just like the name suggest it is a database. CouchDB is a NoSQL database. NoSQL databases doesn’t have any schema, tables, etc, that you’ll typically see in a traditional databases like Oracle or MySQL. The data in CouchDB are stored as JSON document, which you can access from a web browser using HTTP.&lt;br /&gt;
&lt;br /&gt;
This article explains how to install CouchDB on RHEL based systems. For example, CentOS, Red Hat, Oracle Enterprise Linux, etc.&lt;br /&gt;
&lt;br /&gt;
There are two methods to install CouchDB. You can install it from EPEL repository, or install from CouchDB source code.&lt;br /&gt;
&lt;br /&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;Method 1: Install from EPEL&lt;/span&gt;&lt;/h2&gt;
First, &lt;a href=&quot;http://www.thegeekstuff.com/2012/06/enable-epel-repository/&quot;&gt;enable EPEL repository&lt;/a&gt; as we explained earlier.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Verify that the couchdb is available for yum install.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# yum info couchdb
Name        : couchdb
Arch        : x86_64
Version     : 1.0.3
Release     : 2.el6
Size        : 1.7 M
Repo        : epel
Summary     : A document database server, accessible via a RESTful JSON API&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;br /&gt;
Install couchdb. Depending on your system, this might install lot of dependent packages. On my&amp;nbsp;system, it installed 36 packages in total.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# yum install couchdb&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Modify the local.ini file and add a line for bind_address and give the ip-address the system where couchdb is installed.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# vi /etc/couchdb/local.ini
[httpd]
;port = 5984
;bind_address = 127.0.0.1
bind_address = 192.168.101.38&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Start the couchdb services&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# service couchdb start
Starting couchdb:                [  OK  ]

# service couchdb status
couchdb (pid  29915) is running...&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Verify that the couchdb works by going to the URL: http://{your-ip-address}:5984 , it should display a web-page that has the following message.&lt;br /&gt;
&lt;br /&gt;
{“couchdb”:”Welcome”,”version”:”1.0.3″}&lt;br /&gt;
Go to: http://{your-ip-address}:5984/_utils/ from where you can create and manage the couchdb database.&lt;br /&gt;
&lt;h2&gt;















Method 2: Install from CouchDB Source Code&lt;/h2&gt;
If you like to install it yourself from the source code, first you&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;should satisfy all the dependencies.&lt;/span&gt;&lt;br /&gt;
Install the following standard packages from the CentOS repository.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# yum info gcc libtool xulrunner-devel libicu-devel openssl-devel&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;














Install Erlang&lt;/h3&gt;
Download the latest version of Erland from &lt;a href=&quot;http://www.erlang.org/download.html&quot;&gt;here&lt;/a&gt;. Or, you can use the wget as shown below to directly download it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd /usr/src
wget http://www.erlang.org/download/otp_src_R15B01.tar.gz
tar xvfz otp_src_R15B01.tar.gz&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
We’ll be installing couchdb and all its dependencies under /opt/couchdb directory. So, while installing erlang, give the prefix as /opt/couchdb/erlang as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd otp_src_R15B01
./configure --prefix=/opt/couchdb/erlang --without-termcap --without-javac --enable-smp-support --disable-hipe
make
make install
&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;











Install Curl&lt;/h3&gt;
Download the latest version of Curl from &lt;a href=&quot;http://curl.haxx.se/download.html&quot;&gt;here&lt;/a&gt;. Or, you can use the wget as shown below to directly download it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd /usr/src
wget http://curl.haxx.se/download/curl-7.26.0.tar.gz
tar xvfz curl-7.25.0.tar.gz&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Just like Erlang, we’ll be installing Curl also under /opt/couchdb directory. So, while installing curl, give the prefix as /opt/couchdb/curl as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd curl-7.25.0
./configure --prefix=/opt/couchdb/curl
make
make install&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;










SpiderMonkey JS Engine&lt;/h3&gt;
Download the latest version of SpiderMonkey JS from &lt;a href=&quot;https://developer.mozilla.org/en/SpiderMonkey&quot;&gt;here&lt;/a&gt;. Or, you can use the wget as shown below to directly download it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd /usr/src
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
tar xvfz js185-1.0.0.tar.gz&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Please note that you have to cd to “js/src” subdirectory under js-1.8.5 to do the ./configure and make as shown below to install spidermonkey js engine.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd js-1.8.5/js/src
./configure
make
make install&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
You’ll see the libmozjs185.so.1.0.0 and libmozjs185-1.0.a installed under /usr/local/lib&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# ls -ltr /usr/local/lib
-rwxr-xr-x. 1 root root 3671764 May 30 09:39 libmozjs185.so.1.0.0
-rwxr-xr-x. 1 root root 5523616 May 30 09:39 libmozjs185-1.0.a
lrwxrwxrwx. 1 root root      35 May 30 09:40 libmozjs185.so.1.0 -&amp;gt; /usr/local/lib/libmozjs185.so.1.0.0
lrwxrwxrwx. 1 root root      33 May 30 09:40 libmozjs185.so -&amp;gt; /usr/local/lib/libmozjs185.so.1.0&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Note: If spidermonkey JS library is not installed, you’ll get the following error mesage while trying to do the ./configure mentioned in the next step.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;checking for JS_NewObject in -lmozjs185... no

configure: error: Could not find the js library.

Is the Mozilla SpiderMonkey library installed?&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;








Install CouchDB&lt;/h3&gt;
Download the latest version of Couchdb from &lt;a href=&quot;http://couchdb.apache.org/&quot;&gt;here&lt;/a&gt;. Or, you can use the wget as shown below to directly download it.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd /usr/src
wget http://apache.mirrors.pair.com/couchdb/releases/1.2.0/apache-couchdb-1.2.0.tar.gz
tar xvfz apache-couchdb-1.2.0.tar.gz&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
While installing couchdb, you should set ERL, ERLC, CURL_CONFIG environment variables as shown below. These are required during the ./config of couchdb.&lt;br /&gt;
&lt;br /&gt;
Just like the prereqs, we’ll be installing couchdb under /opt/couchdb directory. So, give the prefix as /opt/couchdb/couchdb as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cd apache-couchdb-1.2.0
export ERL=/opt/couchdb/erlang/bin/erl
export ERLC=/opt/couchdb/erlang/bin/erlc
export CURL_CONFIG=/opt/couchdb/curl/bin/curl-config
export LDFLAGS=-L/opt/couchdb/curl/lib
./configure --prefix=/opt/couchdb/couchdb --with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --enable-js-trunk
make
make install&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Note: You’ll use the –enable-js-trunk only if you’ve installed the latest version (anything newer than js185-1.0.0) of the SpiderMonkey JS engine. I recommend that you use –enable-js-trunk option.&lt;br /&gt;
&lt;br /&gt;
If you are not using the latest version of spidermonekey JS engine, you may want to use the flags –with-js-include and –with-js-lib and point it to the appropriate location as shown below.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;./configure --prefix=/opt/couchdb/couchdb --with-erlang=/opt/couchdb/erlang/lib/erlang/usr/include/ --with-js-include=/usr/include/xulrunner-2/ --with-js-lib=/usr/lib64/xulrunner-devel-2/lib/&lt;/span&gt;&lt;/pre&gt;
Note: If you’ve installed the latest version of spidermonkey js, and if you are not using –enable-js-trunk, you’ll get the following error message during “make” of couchdb:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;cc1: warnings being treated as errors
In file included from couch_js/main.c:20:
couch_js/sm170.c: In function req_status:
couch_js/sm170.c:105: error: implicit declaration of function INT_FITS_IN_JSVAL
couch_js/sm170.c: In function evalcx:
couch_js/sm170.c:138: error: implicit declaration of function JS_GetStringChars
couch_js/sm170.c:138: error: assignment makes pointer from integer without a cast
couch_js/sm170.c: In function seal:
couch_js/sm170.c:220: error: implicit declaration of function JS_SealObject
couch_js/sm170.c: At top level:
couch_js/sm170.c:236: error: initialization from incompatible pointer type&lt;/span&gt;&lt;/pre&gt;
&lt;h3&gt;








Setup CouchDB Startup Services&lt;/h3&gt;
Create a couchdb user that is required by the couchdb startup program.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# adduser couchdb&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Change the ownership of the var directory, where couchdb will write logs and some other information.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# chown -R couchdb /opt/couchdb/couchdb/var/&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;Create a link under /etc/init.d for couchdb service&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# ln -s /opt/couchdb/couchdb/etc/rc.d/couchdb /etc/init.d/couchdb&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Finally start the couchdb service.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background-color: #cccccc; border: 1px solid #666666; padding: 15px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;# service couchdb start
Starting database server couchdb&lt;/span&gt;&lt;/pre&gt;
&lt;br /&gt;
Verify that the couchdb works by going to the URL: http://{your-ip-address}:5984 , it should display a web-page that has the following message.&lt;br /&gt;
&lt;br /&gt;
{“couchdb”:”Welcome”,”version”:”1.0.3″}&lt;br /&gt;
&lt;br /&gt;
Go to: http://{your-ip-address}:5984/_utils/ from where you can create and manage the coucbdb database.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/4029065273946930253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/4029065273946930253' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/4029065273946930253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/4029065273946930253'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2012/06/how-to-install-apache-couchdb-on-centos.html' title='How to Install Apache CouchDB on CentOS 6 (from Source and EPEL)'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEzjb6WsbxopA-dLYXJXvSaRkKrgtLhYsfC6XDVfPhQ94IzPw4nRpA74DpDXVdX6K0XWJN-tWOWtLfEvHUJ6I3yILcyieB0USY-4b0F8i6xER2kwuBv7mo8LX-1cG8ZlfpmeC0Ud4C5nQ/s72-c/couchdb-logo.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-5666364811614861233</id><published>2010-03-28T22:29:00.001-07:00</published><updated>2010-03-28T22:31:26.648-07:00</updated><title type='text'>Compile Apache (with SSL), PHP 5 and MySQL on Linux</title><content type='html'>This article comes with a full reference on how to compile from source latest Apache 2.0.53 server, including support for SSL, PHP 5.0.3 as a module, and MySQL 4.1.10 database on a Linux. It was fully tested under SUSE Linux 9.1, SUSE Linux 9.2 and Fedora Core 3, but shall work with any Linux distribution (only on Debian you will have to change RPMs for proper deb packages).&lt;br /&gt;&lt;br /&gt;Today, when almost every Linux distribution comes with a binary form of Apache 2.0.x, PHP 4.3.x and MySQL 4.0.x, it may seem a bit unnecessary to compile these, but, if you want some special configuration, latest components, or simply tune performance of your Apache, PHP and MySQL, compilation from source is the only possibility.&lt;br /&gt;Basic system description:&lt;br /&gt;&lt;br /&gt;PHP 5.0.3 will be compiled with support for: bz2, cpdflib, ctype, curllib, dom, ftp, gd2, freetype2, gettext, libiconv, libxml, mbstring, mysql, openssl, pcre, posix, session, SimpleXML, SPL, SQLite, tokenizer, xml, and zlib.&lt;br /&gt;&lt;br /&gt;Apache 2.0.53 will be compiled with support for mod_access, mod_auth, mod_auth_digest, mod_deflate, mod_env, mod_headers, mod_setenvif, mod_ssl, mod_mime, mod_imap, mod_alias and mod_rewrite.&lt;br /&gt;Compilation options:&lt;br /&gt;&lt;br /&gt;Compilation can be customized by passing several parameters to gcc at runtime, for my Pentium-IV/HT/3.2GHz, this is a good starting set of parameters:&lt;br /&gt;&lt;br /&gt;export CFLAGS=&quot;-march=pentium4 -mfpmath=sse -msse2 -O2 -pipe -s -fomit-frame-pointer&quot;&lt;br /&gt;&lt;br /&gt;You may get a list of gcc compilation options for your CPU at gcc.gnu.org.&lt;br /&gt;&lt;br /&gt;All these scripts were fully tested under SESE Linux 9.1 with custom-built kernel 2.6.8.1 and Fedora Core 3 with custom-built kernel 2.6.9.1, and gcc version 3.3.3 / 3.4.2, but they shall work with any Linux distro (only on Debian you may need to change rpm packages for deb ones).&lt;br /&gt;&lt;br /&gt;This manual assumes that all source files are located (downloaded to) /usr/local/src directory, SSL keys are placed into /home/ssl directory, and web root is located at /home/www directory.&lt;br /&gt;Compile from source (Open) SSL:&lt;br /&gt;&lt;br /&gt;    * We will need OpenSSL library: openssl-0.9.7e.tar.gz&lt;br /&gt;&lt;br /&gt;Compilation of OpenSSL:&lt;br /&gt;&lt;br /&gt;su&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf openssl-0.9.7e.tar.gz&lt;br /&gt;cd openssl-0.9.7e&lt;br /&gt;./config --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Create a private key and place it into directory /home/ssl:&lt;br /&gt;&lt;br /&gt;mkdir /home/ssl&lt;br /&gt;cd /home/ssl&lt;br /&gt;/usr/local/bin/openssl genrsa -des3 -rand \ &lt;br /&gt;  some_big_file_1:some_big_file_2 \&lt;br /&gt;  -out localhost.key 1024&lt;br /&gt;&lt;br /&gt;Next, we will create a private key without a pass-phrase, this is less secure, but it allows us to bootup the server without manually entering the pass-phrase every time…&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl rsa \&lt;br /&gt;  -in localhost.key \&lt;br /&gt;  -out localhost.key.unsecure&lt;br /&gt;&lt;br /&gt;We will also create a request file that will be emailed to proper certification authority for getting a trusted SSL certificate (if needed) under file localhost.key.csr:&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl req -new \&lt;br /&gt;  -key localhost.key \&lt;br /&gt;  -out localhost.key.csr&lt;br /&gt;&lt;br /&gt;While waiting for the certification authority, we can create a temporary self-signed certificate, good for 30 days:&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl x509 -req \&lt;br /&gt;  -days 30 \&lt;br /&gt;  -in localhost.key.csr \&lt;br /&gt;  -signkey localhost.key \&lt;br /&gt;  -out localhost.cert &lt;br /&gt;chmod 400 localhost.cert&lt;br /&gt;chmod 400 localhost.key&lt;br /&gt;chmod 400 localhost.key.unsecure&lt;br /&gt;&lt;br /&gt;Compile MySQL 4.1.10 database from source:&lt;br /&gt;&lt;br /&gt;    * MySQL 4.1.10 source codes - mysql-4.1.10.tar.gz&lt;br /&gt;    * libtermcap library (most distros have it already) - libtermcap-2.0.8-35.i386.rpm&lt;br /&gt;    * libtermcap-devel library (most distros have it already) - libtermcap-devel-2.0.8-35.i386.rpm&lt;br /&gt;&lt;br /&gt;    MySQL 4.1.10 has a completely different communication protocol and associated PHP mysqli functions. If your scripts were not designed for MySQL 4.1, you shall rather get MySQL release 4.0.23, to stay 100% compatible! Compilation options for MYSQL 4.0.23 will be the same, just remove one line with mysqli from PHP ./configure script.&lt;br /&gt;&lt;br /&gt;    However for any new development, MySQL 4.1.10 is recommended.&lt;br /&gt;&lt;br /&gt;Compiling MySQL from source, and creating user / group called mysql:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf mysql-4.1.10.tar.gz&lt;br /&gt;cd mysql-4.1.10&lt;br /&gt;./configure \&lt;br /&gt;  --prefix=/usr/local/mysql \&lt;br /&gt;  --with-unix-sock-path=/tmp/mysql.sock \&lt;br /&gt;  --with-charset=utf8&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;groupadd mysql&lt;br /&gt;useradd -g mysql mysql&lt;br /&gt;cp support-files/my-medium.cnf /etc/my.cnf&lt;br /&gt;cd /usr/local/mysql&lt;br /&gt;bin/mysql_install_db --user=mysql&lt;br /&gt;chown -R root  .&lt;br /&gt;chown -R mysql var&lt;br /&gt;chgrp -R mysql .&lt;br /&gt;&lt;br /&gt;MySQL configuration file /etc/my.cnf can (for our local testing) look like this:&lt;br /&gt;&lt;br /&gt;[client]&lt;br /&gt;port = 3306&lt;br /&gt;socket = /tmp/mysql.sock&lt;br /&gt;[mysqld]&lt;br /&gt;port = 3306&lt;br /&gt;socket = /tmp/mysql.sock&lt;br /&gt;skip-locking&lt;br /&gt;key_buffer = 16K&lt;br /&gt;max_allowed_packet = 1M&lt;br /&gt;table_cache = 4&lt;br /&gt;sort_buffer_size = 64K&lt;br /&gt;net_buffer_length = 2K&lt;br /&gt;thread_stack = 64K&lt;br /&gt;skip-networking&lt;br /&gt;server-id = 1&lt;br /&gt;[mysqldump]&lt;br /&gt;quick&lt;br /&gt;max_allowed_packet = 16M&lt;br /&gt;[mysql]&lt;br /&gt;no-auto-rehash&lt;br /&gt;[isamchk]&lt;br /&gt;key_buffer = 8M&lt;br /&gt;sort_buffer_size = 8M&lt;br /&gt;[myisamchk]&lt;br /&gt;key_buffer = 8M&lt;br /&gt;sort_buffer_size = 8M&lt;br /&gt;[mysqlhotcopy]&lt;br /&gt;interactive-timeout&lt;br /&gt;&lt;br /&gt;Compile from source Apache 2.0.53 web server:&lt;br /&gt;&lt;br /&gt;Quite a few web-hosting companies still use Apache 1.3.x, but time of Apache 2.0 incompatibilities and problems is long gone, so 2.0 is a better choice now.&lt;br /&gt;&lt;br /&gt;    * We will need Apache 2.0.53 source codes - httpd-2.0.53.tar.gz&lt;br /&gt;    * RPM: libxml2 library (most distros have it already) - libxml2-devel-2.6.7-28.i586.rpm&lt;br /&gt;    * RPM: zlib library (most distros have it already) - zlib-devel-1.2.1-70.i586.rpm&lt;br /&gt;    * RPM: readline-devel library (most distros have it already) - readline-devel-4.3-306.i586.rpm&lt;br /&gt;&lt;br /&gt;And compile it:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf httpd-2.0.53.tar.gz&lt;br /&gt;cd httpd-2.0.53&lt;br /&gt;./configure \&lt;br /&gt;   --prefix=/usr/local/apache2 \&lt;br /&gt;   --enable-so \&lt;br /&gt;   --enable-auth-digest \&lt;br /&gt;   --enable-rewrite \&lt;br /&gt;   --enable-setenvif \&lt;br /&gt;   --enable-mime \&lt;br /&gt;   --enable-deflate \&lt;br /&gt;   --enable-ssl \&lt;br /&gt;   --with-ssl=/usr/local \&lt;br /&gt;   --enable-headers&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next we have to modify (alter) main Apache config file located at /usr/local/apache2/conf/httpd.conf (this also assumes your web root is located at /home/www):&lt;br /&gt;&lt;br /&gt;DocumentRoot &quot;/home/www&quot;&lt;br /&gt;&lt;br /&gt;And we well add support for PHP 5 (as a module):&lt;br /&gt;&lt;br /&gt;LoadModule php5_module modules/libphp5.so&lt;br /&gt;DirectoryIndex index.html index.htm index.php&lt;br /&gt;AddType application/x-httpd-php .php&lt;br /&gt;AddType application/x-httpd-php-source .phps&lt;br /&gt;&lt;br /&gt;We also have to allow / create basic mod_rewrite rules:&lt;br /&gt;&lt;br /&gt;&lt;Directory &quot;/home/www&quot;&gt;&lt;br /&gt; Options Indexes Includes FollowSymLinks MultiViews&lt;br /&gt; AllowOverride All&lt;br /&gt; Order allow,deny&lt;br /&gt; Allow from all&lt;br /&gt;&lt;/Directory&gt;&lt;br /&gt;&lt;br /&gt;And dissalow clients to access .htaccess:&lt;br /&gt;&lt;br /&gt;&lt;Files ~ &quot;^.ht&quot;&gt;&lt;br /&gt;   Order allow,deny&lt;br /&gt;   Deny from all&lt;br /&gt;&lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;Next, if using SSL (on standard port 443), we will have to modify file /usr/local/apache2/conf/ssl.conf as follows (just replace the file content with this):&lt;br /&gt;&lt;br /&gt;Listen 443&lt;br /&gt;&lt;VirtualHost _default_:443&gt;&lt;br /&gt; ServerName localhost&lt;br /&gt; SSLEngine on&lt;br /&gt; SSLCertificateFile /home/ssl/localhost.cert&lt;br /&gt; SSLCertificateKeyFile /home/ssl/localhost.key.unsecure&lt;br /&gt;&lt;/VirtualHost&gt;&lt;br /&gt;&lt;br /&gt;Compile from source PHP 5.0.3:&lt;br /&gt;&lt;br /&gt;For compiling PHP, we will need quite a few external libraries, like libcurl, libiconv, libjpeg, libpng, and few others, which we have to download and compile first:&lt;br /&gt;&lt;br /&gt;    * PHP 5.0.3 itself - php-5.0.3.tar.bz2&lt;br /&gt;    * CURL library - curl-7.12.1.tar.gz&lt;br /&gt;    * libiconv library - libiconv-1.9.2.tar.gz&lt;br /&gt;    * JPEG library: jpegsrc.v6b.tar.gz&lt;br /&gt;    * PNG library: libpng-1.2.8.tar.gz&lt;br /&gt;    * cpdflib library: clibpdf202r1.tar.gz&lt;br /&gt;    * Freetype 2 library: freetype-2.1.9.tar.bz2&lt;br /&gt;&lt;br /&gt;Compile libiconv from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf libiconv-1.9.2.tar.gz&lt;br /&gt;cd libiconv-1.9.2&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile libjpeg from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf jpegsrc.v6b.tar.gz&lt;br /&gt;cd jpeg-6b&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;make install-lib&lt;br /&gt;&lt;br /&gt;Compile libpng from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf libpng-1.2.8.tar.gz&lt;br /&gt;cd libpng-1.2.8&lt;br /&gt;cp scripts/makefile.linux makefile&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile cpdflib from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf clibpdf202r1.tar.gz&lt;br /&gt;cd ClibPDF/source&lt;br /&gt;cp Makefile.Linux makefile&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile curl from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf curl-7.12.1.tar.gz&lt;br /&gt;cd curl-7.12.1&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile freetype 2 from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -jxvf freetype-2.1.9.tar.bz2&lt;br /&gt;cd freetype-2.1.9&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next, we will compile PHP, with support for MySQL, iconv, curl, zlib, gd2, mbstring, SSL and many other modules:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -jxvf php-5.0.3.tar.bz2&lt;br /&gt;cd php-5.0.3&lt;br /&gt;./configure \&lt;br /&gt;  --with-apxs2=/usr/local/apache2/bin/apxs \&lt;br /&gt;  --with-mysql=/usr/local/mysql  \&lt;br /&gt;  --with-mysqli=/usr/local/mysql/bin/mysql_config  \&lt;br /&gt;  --with-mysql-sock=/tmp/mysql.sock \&lt;br /&gt;  --with-sqlite \&lt;br /&gt;  --enable-sqlite-utf8 \&lt;br /&gt;  --with-zlib \&lt;br /&gt;  --with-zlib-dir \&lt;br /&gt;  --with-bz2 \&lt;br /&gt;  --with-gd \&lt;br /&gt;  --enable-gd \&lt;br /&gt;  --enable-gd-native-ttf \&lt;br /&gt;  --with-jpeg-dir=/usr/local \&lt;br /&gt;  --with-png-dir=/usr/local \&lt;br /&gt;  --with-ttf \&lt;br /&gt;  --with-freetype-dir=/usr/local \&lt;br /&gt;  --with-iconv=/usr/local \&lt;br /&gt;  --with-curl=/usr/local \&lt;br /&gt;  --enable-track-vars \&lt;br /&gt;  --with-gettext \&lt;br /&gt;  --with-config-file-path=/usr/local/apache2/conf \&lt;br /&gt;  --enable-trans-id \&lt;br /&gt;  --enable-ftp \&lt;br /&gt;  --with-cpdflib=/usr/local \&lt;br /&gt;  --enable-mbstring \&lt;br /&gt;  --with-openssl=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;cp php.ini-dist /usr/local/apache2/conf/php.ini&lt;br /&gt;&lt;br /&gt;Next, we have to modify PHP configuration in file /usr/local/apache2/conf/php.ini, including basic PHP security settings:&lt;br /&gt;&lt;br /&gt;mysql.default_socket = /tmp/mysql.sock&lt;br /&gt;short_open_tag = Off&lt;br /&gt;register_globals = Off&lt;br /&gt;allow_url_fopen = Off&lt;br /&gt;&lt;br /&gt;How to start Apache and MySQL at bootup?&lt;br /&gt;&lt;br /&gt;The last thing left is to create a startup script, whitch will allow to run Apache and MySQL at bootup, automatically, so that we don’t have to do it manually. We will create a new file (for SuSE Linux 9.1, other ditros may vary here) /etc/init.d/web and set “executable” flag to it.&lt;br /&gt;&lt;br /&gt;#! /bin/sh&lt;br /&gt;#&lt;br /&gt;# /etc/init.d/web&lt;br /&gt;#&lt;br /&gt;# (c) Radek HULAN&lt;br /&gt;# http://hulan.info/&lt;br /&gt;#&lt;br /&gt;### BEGIN INIT INFO&lt;br /&gt;# Provides:       apache-mysql&lt;br /&gt;# Default-Start:  5&lt;br /&gt;# Default-Stop:   5&lt;br /&gt;# Description:    Starts Apache2 and MySQL 4&lt;br /&gt;### END INIT INFO&lt;br /&gt;&lt;br /&gt;case &quot;$1&quot; in&lt;br /&gt;        start)&lt;br /&gt;        /usr/local/apache2/bin/apachectl start&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server start&lt;br /&gt;                ;;&lt;br /&gt;        stop)&lt;br /&gt;        /usr/local/apache2/bin/apachectl stop&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server stop&lt;br /&gt;                ;;&lt;br /&gt;        restart)&lt;br /&gt;        /usr/local/apache2/bin/apachectl restart&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server restart&lt;br /&gt;                ;;&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;Next we will run YaST, section “System”, sub-section “Run level editor”, where we will enable service web for runlevel 3 and 5.&lt;br /&gt;Testing the system?&lt;br /&gt;&lt;br /&gt;First, start Apache and MySQL servers by entering:&lt;br /&gt;&lt;br /&gt;/etc/init.d/web start&lt;br /&gt;&lt;br /&gt;Next, create file /home/www/index.php with the following content:&lt;br /&gt;&lt;br /&gt;&lt;?php phpinfo(); ?&gt;&lt;br /&gt;&lt;br /&gt;In your browser, type URL http://localhost/ and https://localhost/, and if everything is installed fine, you will see a lot of information about your new Apache/PHP/MySQL installation.&lt;br /&gt;phpMyAdmin:&lt;br /&gt;&lt;br /&gt;We will also need phpMyAdmin to manage MySQL database, by entering http://localhost/db/ into our browser:&lt;br /&gt;&lt;br /&gt;    * phpMyAdmin 2.6.1 - phpMyAdmin-2.6.1.tar.bz2&lt;br /&gt;&lt;br /&gt;Installation of phpMyAdmin into /home/www/db:&lt;br /&gt;&lt;br /&gt;mkdir /home/www&lt;br /&gt;cd /home/www&lt;br /&gt;tar -jxvf /usr/local/src/phpMyAdmin-2.6.1.tar.bz2&lt;br /&gt;ln -s phpMyAdmin-2.6.1 db&lt;br /&gt;&lt;br /&gt;Next, we will configure phpMyAdmin’s advanced feaures, by modifying file /home/www/db/config.inc.php:&lt;br /&gt;&lt;br /&gt;// URL to phpMyAdmin&lt;br /&gt;$cfg[&#39;PmaAbsoluteUri&#39;] = &#39;http://localhost/db/&#39;;&lt;br /&gt;&lt;br /&gt;//connection settings&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;connect_type&#39;] = &#39;socket&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;extension&#39;] = &#39;mysqli&#39;;&lt;br /&gt;&lt;br /&gt;// user na password&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;auth_type&#39;] = &#39;config&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;user&#39;] = &#39;root&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;password&#39;] = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;// PMA settings&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;pmadb&#39;] = &#39;phpmyadmin&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;bookmarktable&#39;] = &#39;pma_bookmark&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;relation&#39;] = &#39;pma_relation&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;table_info&#39;] = &#39;pma_table_info&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;table_coords&#39;] = &#39;pma_table_coords&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;pdf_pages&#39;] = &#39;pma_pdf_pages&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;column_info&#39;] = &#39;pma_column_info&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;history&#39;] = &#39;pma_history&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;verbose_check&#39;] = FALSE;&lt;br /&gt;&lt;br /&gt;// persistent connections&lt;br /&gt;$cfg[&#39;PersistentConnections&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;// do not display logo on the left&lt;br /&gt;$cfg[&#39;LeftDisplayLogo&#39;] = FALSE;&lt;br /&gt;&lt;br /&gt;// show MySQL and PHP info&lt;br /&gt;$cfg[&#39;ShowMysqlInfo&#39;] = TRUE;&lt;br /&gt;$cfg[&#39;ShowMysqlVars&#39;] = TRUE;&lt;br /&gt;$cfg[&#39;ShowPhpInfo&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;// show BLOBs&lt;br /&gt;$cfg[&#39;ShowBlob&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;After everything is installed, use phpMyAdmin SQL window to run script /home/www/db/scripts/create_tables_mysql_4_1_2+.sql to create PMA tables, needed by phpMyAdmin.&lt;br /&gt;Debugging PHP:&lt;br /&gt;&lt;br /&gt;There are several tools, like PHPeclipse, which allow to debug PHP, in a full-featured IDE. In order to use PHPeclipse, you need to install PHP debugger first.&lt;br /&gt;&lt;br /&gt;    * Get Nusphere DBG: dbg-2.11.32-src.tar.gz.&lt;br /&gt;&lt;br /&gt;Installation:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf dbg-2.11.32-src.tar.gz&lt;br /&gt;cd dbg-2.11.32&lt;br /&gt;./deferphpize&lt;br /&gt;mkdir /usr/local/modules&lt;br /&gt;cp modules/dbg.so /usr/local/modules&lt;br /&gt;cp modules/dbg.la /usr/local/modules&lt;br /&gt;&lt;br /&gt;Next, you will have to modify PHP configuration file located at /usr/local/apache2/conf/php.ini, add here:&lt;br /&gt;&lt;br /&gt;; load debugger&lt;br /&gt;extension_dir = &quot;/usr/local/modules&quot;&lt;br /&gt;extension=dbg.so&lt;br /&gt;&lt;br /&gt;; debugger configuration&lt;br /&gt;[debugger]&lt;br /&gt;debugger.enabled = true&lt;br /&gt;debugger.profiler_enabled = true&lt;br /&gt;debugger.JIT_host = localhost&lt;br /&gt;debugger.JIT_port = 10001&lt;br /&gt;debugger.JIT_enabled = on&lt;br /&gt;&lt;br /&gt;; implicint flush - use only when debugging&lt;br /&gt;implicit_flush = On&lt;br /&gt;&lt;br /&gt;Do you need mod_perl as well?&lt;br /&gt;&lt;br /&gt;    * Get mod_perl-2.0-current.tar.gz.&lt;br /&gt;&lt;br /&gt;Installation and compilation:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar zxvf mod_perl-2.0-current.tar.gz&lt;br /&gt;cd mod_perl-1.99_16&lt;br /&gt;perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next, you have to modify Apache configuration file located at /usr/local/apache2/conf/httpd.conf to load mod_perl, and set to use perl at directory /home/www/perl:&lt;br /&gt;&lt;br /&gt;LoadModule perl_module modules/mod_perl.so&lt;br /&gt;PerlModule Apache2&lt;br /&gt;Alias /perl/ /home/www/perl/&lt;br /&gt;&lt;Location /perl/&gt;&lt;br /&gt;    SetHandler perl-script&lt;br /&gt;    PerlResponseHandler ModPerl::Registry&lt;br /&gt;    PerlOptions +ParseHeaders&lt;br /&gt;    Options +ExecCGI&lt;br /&gt;&lt;/Location&gt;&lt;br /&gt;&lt;br /&gt;Testing? Create file /home/www/perl/test.pl, issue chmod 755 test.pl on it, and type http://localhost/perl/test.pl in your browser to test your mod_perl installation.&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;print &quot;Content-type: text/plain\n\n&quot;;&lt;br /&gt;print &quot;mod_perl 2.0 rocks!\n&quot;;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/5666364811614861233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/5666364811614861233' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5666364811614861233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5666364811614861233'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2010/03/compile-apache-with-ssl-php-5-and-mysql_28.html' title='Compile Apache (with SSL), PHP 5 and MySQL on Linux'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-5553766197141605822</id><published>2010-03-28T22:29:00.000-07:00</published><updated>2010-03-28T22:30:34.393-07:00</updated><title type='text'>Compile Apache (with SSL), PHP 5 and MySQL on Linux</title><content type='html'>This article comes with a full reference on how to compile from source latest Apache 2.0.53 server, including support for SSL, PHP 5.0.3 as a module, and MySQL 4.1.10 database on a Linux. It was fully tested under SUSE Linux 9.1, SUSE Linux 9.2 and Fedora Core 3, but shall work with any Linux distribution (only on Debian you will have to change RPMs for proper deb packages).&lt;br /&gt;&lt;br /&gt;Today, when almost every Linux distribution comes with a binary form of Apache 2.0.x, PHP 4.3.x and MySQL 4.0.x, it may seem a bit unnecessary to compile these, but, if you want some special configuration, latest components, or simply tune performance of your Apache, PHP and MySQL, compilation from source is the only possibility.&lt;br /&gt;Basic system description:&lt;br /&gt;&lt;br /&gt;PHP 5.0.3 will be compiled with support for: bz2, cpdflib, ctype, curllib, dom, ftp, gd2, freetype2, gettext, libiconv, libxml, mbstring, mysql, openssl, pcre, posix, session, SimpleXML, SPL, SQLite, tokenizer, xml, and zlib.&lt;br /&gt;&lt;br /&gt;Apache 2.0.53 will be compiled with support for mod_access, mod_auth, mod_auth_digest, mod_deflate, mod_env, mod_headers, mod_setenvif, mod_ssl, mod_mime, mod_imap, mod_alias and mod_rewrite.&lt;br /&gt;Compilation options:&lt;br /&gt;&lt;br /&gt;Compilation can be customized by passing several parameters to gcc at runtime, for my Pentium-IV/HT/3.2GHz, this is a good starting set of parameters:&lt;br /&gt;&lt;br /&gt;export CFLAGS=&quot;-march=pentium4 -mfpmath=sse -msse2 -O2 -pipe -s -fomit-frame-pointer&quot;&lt;br /&gt;&lt;br /&gt;You may get a list of gcc compilation options for your CPU at gcc.gnu.org.&lt;br /&gt;&lt;br /&gt;All these scripts were fully tested under SESE Linux 9.1 with custom-built kernel 2.6.8.1 and Fedora Core 3 with custom-built kernel 2.6.9.1, and gcc version 3.3.3 / 3.4.2, but they shall work with any Linux distro (only on Debian you may need to change rpm packages for deb ones).&lt;br /&gt;&lt;br /&gt;This manual assumes that all source files are located (downloaded to) /usr/local/src directory, SSL keys are placed into /home/ssl directory, and web root is located at /home/www directory.&lt;br /&gt;Compile from source (Open) SSL:&lt;br /&gt;&lt;br /&gt;    * We will need OpenSSL library: openssl-0.9.7e.tar.gz&lt;br /&gt;&lt;br /&gt;Compilation of OpenSSL:&lt;br /&gt;&lt;br /&gt;su&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf openssl-0.9.7e.tar.gz&lt;br /&gt;cd openssl-0.9.7e&lt;br /&gt;./config --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Create a private key and place it into directory /home/ssl:&lt;br /&gt;&lt;br /&gt;mkdir /home/ssl&lt;br /&gt;cd /home/ssl&lt;br /&gt;/usr/local/bin/openssl genrsa -des3 -rand \ &lt;br /&gt;  some_big_file_1:some_big_file_2 \&lt;br /&gt;  -out localhost.key 1024&lt;br /&gt;&lt;br /&gt;Next, we will create a private key without a pass-phrase, this is less secure, but it allows us to bootup the server without manually entering the pass-phrase every time…&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl rsa \&lt;br /&gt;  -in localhost.key \&lt;br /&gt;  -out localhost.key.unsecure&lt;br /&gt;&lt;br /&gt;We will also create a request file that will be emailed to proper certification authority for getting a trusted SSL certificate (if needed) under file localhost.key.csr:&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl req -new \&lt;br /&gt;  -key localhost.key \&lt;br /&gt;  -out localhost.key.csr&lt;br /&gt;&lt;br /&gt;While waiting for the certification authority, we can create a temporary self-signed certificate, good for 30 days:&lt;br /&gt;&lt;br /&gt;/usr/local/bin/openssl x509 -req \&lt;br /&gt;  -days 30 \&lt;br /&gt;  -in localhost.key.csr \&lt;br /&gt;  -signkey localhost.key \&lt;br /&gt;  -out localhost.cert &lt;br /&gt;chmod 400 localhost.cert&lt;br /&gt;chmod 400 localhost.key&lt;br /&gt;chmod 400 localhost.key.unsecure&lt;br /&gt;&lt;br /&gt;Compile MySQL 4.1.10 database from source:&lt;br /&gt;&lt;br /&gt;    * MySQL 4.1.10 source codes - mysql-4.1.10.tar.gz&lt;br /&gt;    * libtermcap library (most distros have it already) - libtermcap-2.0.8-35.i386.rpm&lt;br /&gt;    * libtermcap-devel library (most distros have it already) - libtermcap-devel-2.0.8-35.i386.rpm&lt;br /&gt;&lt;br /&gt;    MySQL 4.1.10 has a completely different communication protocol and associated PHP mysqli functions. If your scripts were not designed for MySQL 4.1, you shall rather get MySQL release 4.0.23, to stay 100% compatible! Compilation options for MYSQL 4.0.23 will be the same, just remove one line with mysqli from PHP ./configure script.&lt;br /&gt;&lt;br /&gt;    However for any new development, MySQL 4.1.10 is recommended.&lt;br /&gt;&lt;br /&gt;Compiling MySQL from source, and creating user / group called mysql:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf mysql-4.1.10.tar.gz&lt;br /&gt;cd mysql-4.1.10&lt;br /&gt;./configure \&lt;br /&gt;  --prefix=/usr/local/mysql \&lt;br /&gt;  --with-unix-sock-path=/tmp/mysql.sock \&lt;br /&gt;  --with-charset=utf8&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;groupadd mysql&lt;br /&gt;useradd -g mysql mysql&lt;br /&gt;cp support-files/my-medium.cnf /etc/my.cnf&lt;br /&gt;cd /usr/local/mysql&lt;br /&gt;bin/mysql_install_db --user=mysql&lt;br /&gt;chown -R root  .&lt;br /&gt;chown -R mysql var&lt;br /&gt;chgrp -R mysql .&lt;br /&gt;&lt;br /&gt;MySQL configuration file /etc/my.cnf can (for our local testing) look like this:&lt;br /&gt;&lt;br /&gt;[client]&lt;br /&gt;port = 3306&lt;br /&gt;socket = /tmp/mysql.sock&lt;br /&gt;[mysqld]&lt;br /&gt;port = 3306&lt;br /&gt;socket = /tmp/mysql.sock&lt;br /&gt;skip-locking&lt;br /&gt;key_buffer = 16K&lt;br /&gt;max_allowed_packet = 1M&lt;br /&gt;table_cache = 4&lt;br /&gt;sort_buffer_size = 64K&lt;br /&gt;net_buffer_length = 2K&lt;br /&gt;thread_stack = 64K&lt;br /&gt;skip-networking&lt;br /&gt;server-id = 1&lt;br /&gt;[mysqldump]&lt;br /&gt;quick&lt;br /&gt;max_allowed_packet = 16M&lt;br /&gt;[mysql]&lt;br /&gt;no-auto-rehash&lt;br /&gt;[isamchk]&lt;br /&gt;key_buffer = 8M&lt;br /&gt;sort_buffer_size = 8M&lt;br /&gt;[myisamchk]&lt;br /&gt;key_buffer = 8M&lt;br /&gt;sort_buffer_size = 8M&lt;br /&gt;[mysqlhotcopy]&lt;br /&gt;interactive-timeout&lt;br /&gt;&lt;br /&gt;Compile from source Apache 2.0.53 web server:&lt;br /&gt;&lt;br /&gt;Quite a few web-hosting companies still use Apache 1.3.x, but time of Apache 2.0 incompatibilities and problems is long gone, so 2.0 is a better choice now.&lt;br /&gt;&lt;br /&gt;    * We will need Apache 2.0.53 source codes - httpd-2.0.53.tar.gz&lt;br /&gt;    * RPM: libxml2 library (most distros have it already) - libxml2-devel-2.6.7-28.i586.rpm&lt;br /&gt;    * RPM: zlib library (most distros have it already) - zlib-devel-1.2.1-70.i586.rpm&lt;br /&gt;    * RPM: readline-devel library (most distros have it already) - readline-devel-4.3-306.i586.rpm&lt;br /&gt;&lt;br /&gt;And compile it:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf httpd-2.0.53.tar.gz&lt;br /&gt;cd httpd-2.0.53&lt;br /&gt;./configure \&lt;br /&gt;   --prefix=/usr/local/apache2 \&lt;br /&gt;   --enable-so \&lt;br /&gt;   --enable-auth-digest \&lt;br /&gt;   --enable-rewrite \&lt;br /&gt;   --enable-setenvif \&lt;br /&gt;   --enable-mime \&lt;br /&gt;   --enable-deflate \&lt;br /&gt;   --enable-ssl \&lt;br /&gt;   --with-ssl=/usr/local \&lt;br /&gt;   --enable-headers&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next we have to modify (alter) main Apache config file located at /usr/local/apache2/conf/httpd.conf (this also assumes your web root is located at /home/www):&lt;br /&gt;&lt;br /&gt;DocumentRoot &quot;/home/www&quot;&lt;br /&gt;&lt;br /&gt;And we well add support for PHP 5 (as a module):&lt;br /&gt;&lt;br /&gt;LoadModule php5_module modules/libphp5.so&lt;br /&gt;DirectoryIndex index.html index.htm index.php&lt;br /&gt;AddType application/x-httpd-php .php&lt;br /&gt;AddType application/x-httpd-php-source .phps&lt;br /&gt;&lt;br /&gt;We also have to allow / create basic mod_rewrite rules:&lt;br /&gt;&lt;br /&gt;&lt;Directory &quot;/home/www&quot;&gt;&lt;br /&gt; Options Indexes Includes FollowSymLinks MultiViews&lt;br /&gt; AllowOverride All&lt;br /&gt; Order allow,deny&lt;br /&gt; Allow from all&lt;br /&gt;&lt;/Directory&gt;&lt;br /&gt;&lt;br /&gt;And dissalow clients to access .htaccess:&lt;br /&gt;&lt;br /&gt;&lt;Files ~ &quot;^.ht&quot;&gt;&lt;br /&gt;   Order allow,deny&lt;br /&gt;   Deny from all&lt;br /&gt;&lt;/Files&gt;&lt;br /&gt;&lt;br /&gt;Next, if using SSL (on standard port 443), we will have to modify file /usr/local/apache2/conf/ssl.conf as follows (just replace the file content with this):&lt;br /&gt;&lt;br /&gt;Listen 443&lt;br /&gt;&lt;VirtualHost _default_:443&gt;&lt;br /&gt; ServerName localhost&lt;br /&gt; SSLEngine on&lt;br /&gt; SSLCertificateFile /home/ssl/localhost.cert&lt;br /&gt; SSLCertificateKeyFile /home/ssl/localhost.key.unsecure&lt;br /&gt;&lt;/VirtualHost&gt;&lt;br /&gt;&lt;br /&gt;Compile from source PHP 5.0.3:&lt;br /&gt;&lt;br /&gt;For compiling PHP, we will need quite a few external libraries, like libcurl, libiconv, libjpeg, libpng, and few others, which we have to download and compile first:&lt;br /&gt;&lt;br /&gt;    * PHP 5.0.3 itself - php-5.0.3.tar.bz2&lt;br /&gt;    * CURL library - curl-7.12.1.tar.gz&lt;br /&gt;    * libiconv library - libiconv-1.9.2.tar.gz&lt;br /&gt;    * JPEG library: jpegsrc.v6b.tar.gz&lt;br /&gt;    * PNG library: libpng-1.2.8.tar.gz&lt;br /&gt;    * cpdflib library: clibpdf202r1.tar.gz&lt;br /&gt;    * Freetype 2 library: freetype-2.1.9.tar.bz2&lt;br /&gt;&lt;br /&gt;Compile libiconv from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf libiconv-1.9.2.tar.gz&lt;br /&gt;cd libiconv-1.9.2&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile libjpeg from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf jpegsrc.v6b.tar.gz&lt;br /&gt;cd jpeg-6b&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;make install-lib&lt;br /&gt;&lt;br /&gt;Compile libpng from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf libpng-1.2.8.tar.gz&lt;br /&gt;cd libpng-1.2.8&lt;br /&gt;cp scripts/makefile.linux makefile&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile cpdflib from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf clibpdf202r1.tar.gz&lt;br /&gt;cd ClibPDF/source&lt;br /&gt;cp Makefile.Linux makefile&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile curl from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf curl-7.12.1.tar.gz&lt;br /&gt;cd curl-7.12.1&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Compile freetype 2 from source:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -jxvf freetype-2.1.9.tar.bz2&lt;br /&gt;cd freetype-2.1.9&lt;br /&gt;./configure --prefix=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next, we will compile PHP, with support for MySQL, iconv, curl, zlib, gd2, mbstring, SSL and many other modules:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -jxvf php-5.0.3.tar.bz2&lt;br /&gt;cd php-5.0.3&lt;br /&gt;./configure \&lt;br /&gt;  --with-apxs2=/usr/local/apache2/bin/apxs \&lt;br /&gt;  --with-mysql=/usr/local/mysql  \&lt;br /&gt;  --with-mysqli=/usr/local/mysql/bin/mysql_config  \&lt;br /&gt;  --with-mysql-sock=/tmp/mysql.sock \&lt;br /&gt;  --with-sqlite \&lt;br /&gt;  --enable-sqlite-utf8 \&lt;br /&gt;  --with-zlib \&lt;br /&gt;  --with-zlib-dir \&lt;br /&gt;  --with-bz2 \&lt;br /&gt;  --with-gd \&lt;br /&gt;  --enable-gd \&lt;br /&gt;  --enable-gd-native-ttf \&lt;br /&gt;  --with-jpeg-dir=/usr/local \&lt;br /&gt;  --with-png-dir=/usr/local \&lt;br /&gt;  --with-ttf \&lt;br /&gt;  --with-freetype-dir=/usr/local \&lt;br /&gt;  --with-iconv=/usr/local \&lt;br /&gt;  --with-curl=/usr/local \&lt;br /&gt;  --enable-track-vars \&lt;br /&gt;  --with-gettext \&lt;br /&gt;  --with-config-file-path=/usr/local/apache2/conf \&lt;br /&gt;  --enable-trans-id \&lt;br /&gt;  --enable-ftp \&lt;br /&gt;  --with-cpdflib=/usr/local \&lt;br /&gt;  --enable-mbstring \&lt;br /&gt;  --with-openssl=/usr/local&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;cp php.ini-dist /usr/local/apache2/conf/php.ini&lt;br /&gt;&lt;br /&gt;Next, we have to modify PHP configuration in file /usr/local/apache2/conf/php.ini, including basic PHP security settings:&lt;br /&gt;&lt;br /&gt;mysql.default_socket = /tmp/mysql.sock&lt;br /&gt;short_open_tag = Off&lt;br /&gt;register_globals = Off&lt;br /&gt;allow_url_fopen = Off&lt;br /&gt;&lt;br /&gt;How to start Apache and MySQL at bootup?&lt;br /&gt;&lt;br /&gt;The last thing left is to create a startup script, whitch will allow to run Apache and MySQL at bootup, automatically, so that we don’t have to do it manually. We will create a new file (for SuSE Linux 9.1, other ditros may vary here) /etc/init.d/web and set “executable” flag to it.&lt;br /&gt;&lt;br /&gt;#! /bin/sh&lt;br /&gt;#&lt;br /&gt;# /etc/init.d/web&lt;br /&gt;#&lt;br /&gt;# (c) Radek HULAN&lt;br /&gt;# http://hulan.info/&lt;br /&gt;#&lt;br /&gt;### BEGIN INIT INFO&lt;br /&gt;# Provides:       apache-mysql&lt;br /&gt;# Default-Start:  5&lt;br /&gt;# Default-Stop:   5&lt;br /&gt;# Description:    Starts Apache2 and MySQL 4&lt;br /&gt;### END INIT INFO&lt;br /&gt;&lt;br /&gt;case &quot;$1&quot; in&lt;br /&gt;        start)&lt;br /&gt;        /usr/local/apache2/bin/apachectl start&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server start&lt;br /&gt;                ;;&lt;br /&gt;        stop)&lt;br /&gt;        /usr/local/apache2/bin/apachectl stop&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server stop&lt;br /&gt;                ;;&lt;br /&gt;        restart)&lt;br /&gt;        /usr/local/apache2/bin/apachectl restart&lt;br /&gt;        /usr/local/mysql/share/mysql/mysql.server restart&lt;br /&gt;                ;;&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;Next we will run YaST, section “System”, sub-section “Run level editor”, where we will enable service web for runlevel 3 and 5.&lt;br /&gt;Testing the system?&lt;br /&gt;&lt;br /&gt;First, start Apache and MySQL servers by entering:&lt;br /&gt;&lt;br /&gt;/etc/init.d/web start&lt;br /&gt;&lt;br /&gt;Next, create file /home/www/index.php with the following content:&lt;br /&gt;&lt;br /&gt;&lt;?php phpinfo(); ?&gt;&lt;br /&gt;&lt;br /&gt;In your browser, type URL http://localhost/ and https://localhost/, and if everything is installed fine, you will see a lot of information about your new Apache/PHP/MySQL installation.&lt;br /&gt;phpMyAdmin:&lt;br /&gt;&lt;br /&gt;We will also need phpMyAdmin to manage MySQL database, by entering http://localhost/db/ into our browser:&lt;br /&gt;&lt;br /&gt;    * phpMyAdmin 2.6.1 - phpMyAdmin-2.6.1.tar.bz2&lt;br /&gt;&lt;br /&gt;Installation of phpMyAdmin into /home/www/db:&lt;br /&gt;&lt;br /&gt;mkdir /home/www&lt;br /&gt;cd /home/www&lt;br /&gt;tar -jxvf /usr/local/src/phpMyAdmin-2.6.1.tar.bz2&lt;br /&gt;ln -s phpMyAdmin-2.6.1 db&lt;br /&gt;&lt;br /&gt;Next, we will configure phpMyAdmin’s advanced feaures, by modifying file /home/www/db/config.inc.php:&lt;br /&gt;&lt;br /&gt;// URL to phpMyAdmin&lt;br /&gt;$cfg[&#39;PmaAbsoluteUri&#39;] = &#39;http://localhost/db/&#39;;&lt;br /&gt;&lt;br /&gt;//connection settings&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;connect_type&#39;] = &#39;socket&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;extension&#39;] = &#39;mysqli&#39;;&lt;br /&gt;&lt;br /&gt;// user na password&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;auth_type&#39;] = &#39;config&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;user&#39;] = &#39;root&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;password&#39;] = &#39;&#39;;&lt;br /&gt;&lt;br /&gt;// PMA settings&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;pmadb&#39;] = &#39;phpmyadmin&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;bookmarktable&#39;] = &#39;pma_bookmark&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;relation&#39;] = &#39;pma_relation&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;table_info&#39;] = &#39;pma_table_info&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;table_coords&#39;] = &#39;pma_table_coords&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;pdf_pages&#39;] = &#39;pma_pdf_pages&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;column_info&#39;] = &#39;pma_column_info&#39;; &lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;history&#39;] = &#39;pma_history&#39;;&lt;br /&gt;$cfg[&#39;Servers&#39;][$i][&#39;verbose_check&#39;] = FALSE;&lt;br /&gt;&lt;br /&gt;// persistent connections&lt;br /&gt;$cfg[&#39;PersistentConnections&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;// do not display logo on the left&lt;br /&gt;$cfg[&#39;LeftDisplayLogo&#39;] = FALSE;&lt;br /&gt;&lt;br /&gt;// show MySQL and PHP info&lt;br /&gt;$cfg[&#39;ShowMysqlInfo&#39;] = TRUE;&lt;br /&gt;$cfg[&#39;ShowMysqlVars&#39;] = TRUE;&lt;br /&gt;$cfg[&#39;ShowPhpInfo&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;// show BLOBs&lt;br /&gt;$cfg[&#39;ShowBlob&#39;] = TRUE;&lt;br /&gt;&lt;br /&gt;After everything is installed, use phpMyAdmin SQL window to run script /home/www/db/scripts/create_tables_mysql_4_1_2+.sql to create PMA tables, needed by phpMyAdmin.&lt;br /&gt;Debugging PHP:&lt;br /&gt;&lt;br /&gt;There are several tools, like PHPeclipse, which allow to debug PHP, in a full-featured IDE. In order to use PHPeclipse, you need to install PHP debugger first.&lt;br /&gt;&lt;br /&gt;    * Get Nusphere DBG: dbg-2.11.32-src.tar.gz.&lt;br /&gt;&lt;br /&gt;Installation:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar -zxvf dbg-2.11.32-src.tar.gz&lt;br /&gt;cd dbg-2.11.32&lt;br /&gt;./deferphpize&lt;br /&gt;mkdir /usr/local/modules&lt;br /&gt;cp modules/dbg.so /usr/local/modules&lt;br /&gt;cp modules/dbg.la /usr/local/modules&lt;br /&gt;&lt;br /&gt;Next, you will have to modify PHP configuration file located at /usr/local/apache2/conf/php.ini, add here:&lt;br /&gt;&lt;br /&gt;; load debugger&lt;br /&gt;extension_dir = &quot;/usr/local/modules&quot;&lt;br /&gt;extension=dbg.so&lt;br /&gt;&lt;br /&gt;; debugger configuration&lt;br /&gt;[debugger]&lt;br /&gt;debugger.enabled = true&lt;br /&gt;debugger.profiler_enabled = true&lt;br /&gt;debugger.JIT_host = localhost&lt;br /&gt;debugger.JIT_port = 10001&lt;br /&gt;debugger.JIT_enabled = on&lt;br /&gt;&lt;br /&gt;; implicint flush - use only when debugging&lt;br /&gt;implicit_flush = On&lt;br /&gt;&lt;br /&gt;Do you need mod_perl as well?&lt;br /&gt;&lt;br /&gt;    * Get mod_perl-2.0-current.tar.gz.&lt;br /&gt;&lt;br /&gt;Installation and compilation:&lt;br /&gt;&lt;br /&gt;cd /usr/local/src&lt;br /&gt;tar zxvf mod_perl-2.0-current.tar.gz&lt;br /&gt;cd mod_perl-1.99_16&lt;br /&gt;perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs&lt;br /&gt;make&lt;br /&gt;make install&lt;br /&gt;&lt;br /&gt;Next, you have to modify Apache configuration file located at /usr/local/apache2/conf/httpd.conf to load mod_perl, and set to use perl at directory /home/www/perl:&lt;br /&gt;&lt;br /&gt;LoadModule perl_module modules/mod_perl.so&lt;br /&gt;PerlModule Apache2&lt;br /&gt;Alias /perl/ /home/www/perl/&lt;br /&gt;&lt;Location /perl/&gt;&lt;br /&gt;    SetHandler perl-script&lt;br /&gt;    PerlResponseHandler ModPerl::Registry&lt;br /&gt;    PerlOptions +ParseHeaders&lt;br /&gt;    Options +ExecCGI&lt;br /&gt;&lt;/Location&gt;&lt;br /&gt;&lt;br /&gt;Testing? Create file /home/www/perl/test.pl, issue chmod 755 test.pl on it, and type http://localhost/perl/test.pl in your browser to test your mod_perl installation.&lt;br /&gt;&lt;br /&gt;#!/usr/bin/perl&lt;br /&gt;print &quot;Content-type: text/plain\n\n&quot;;&lt;br /&gt;print &quot;mod_perl 2.0 rocks!\n&quot;;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/5553766197141605822/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/5553766197141605822' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5553766197141605822'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/5553766197141605822'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2010/03/compile-apache-with-ssl-php-5-and-mysql.html' title='Compile Apache (with SSL), PHP 5 and MySQL on Linux'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-8862697871644885897</id><published>2010-03-25T23:11:00.000-07:00</published><updated>2010-03-25T23:13:19.146-07:00</updated><title type='text'>PHP4 Vs PHP5</title><content type='html'>You probably know that PHP 5 is destined for OOP, but it appears that habitual programming can be used too. Moreover, OOP is used in PHP4 as well, with the difference that in PHP5 things are a little more evaluated. This means that in PHP4 safety modes for classes (public, private) are not accepted. In PHP4 the objects are a kind of structures which accept objects and functions as well, according to OOP. In PHP4 they are useful as well.&lt;br /&gt;&lt;br /&gt;If you are used to working with PHP4 you can use PHP5 with no problems because the differences are not significant and the changes were made so that programmers would not be confused. An example would be class builders which, in PHP4 were functions within the classes bearing the same name as the class. In PHP5 it is firstly checked if there is a function (method) __construct (). If it does not exist, check if there is a function (method) which has the same name as the class. This means that even if you are not aware of the latest news in the domain of PHP5, your scripts will function without any problem.&lt;br /&gt;&lt;br /&gt;If you want to install PHP4 and PHP5 in parallel, you can set USE indicators, which are different for each version and you can find out a lot of other important pieces of information asking us.</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/8862697871644885897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/8862697871644885897' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/8862697871644885897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/8862697871644885897'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2010/03/php4-vs-php5.html' title='PHP4 Vs PHP5'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-7716476280028688798</id><published>2010-03-25T23:09:00.001-07:00</published><updated>2010-03-25T23:09:47.042-07:00</updated><title type='text'>PHP5 Vs PHP6</title><content type='html'>PHP is actually a set of extensions that are all gathered together in order to make what we currently have. Nevertheless, these extensions can be changed and the same happens to the collection. Let’s imagine, for example the XML Writer extension. It is a very good extension for writing XML files. A similar extension, XML Reader, has already been attached and allowed in the essential distribution in PHP 5.1, and currently XML Writer will use its model in PHP 6, making an excellent couple in order to work easily with XML files.&lt;br /&gt;&lt;br /&gt;Another modification in the essential distribution is the exclusion of the ereg frequent expressions library that is going to become an extension. ereg is now used as a competitor of PCRE (preg_match, etc.), but it seems to cause some problems. Consequently, the experts have made the decision to take it out of the core and change it into an extension.&lt;br /&gt;&lt;br /&gt;Now, media type detection is not quite good in PHP. There is mime_magic extension, which is not quite useful. Therefore in PHP 6, the Fileinfo extension will replace mime_magic and it will be integrated in the core while mime_magic will be taken out of the core and changed into extension.&lt;br /&gt;&lt;br /&gt;These changes seem to be really interesting. You can conclude that PHP 6 is not really a huge characteristics upgrade, but it is more a great cleanup based on optimizing a lot of functions which already exist, on the move. There are professionals working with PHP almost every day and they can notice improvements every moment.</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/7716476280028688798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/7716476280028688798' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/7716476280028688798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/7716476280028688798'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2010/03/php5-vs-php6.html' title='PHP5 Vs PHP6'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-6800067931659289444</id><published>2010-01-11T04:15:00.001-08:00</published><updated>2010-01-11T04:15:52.904-08:00</updated><title type='text'>Symmetric vs. asymmetric algorithms</title><content type='html'>&lt;div xmlns=&#39;http://www.w3.org/1999/xhtml&#39;&gt;&lt;p&gt;When using symmetric algorithms, both parties share the same key for en- and decryption. To provide privacy, this key needs to be kept secret. Once somebody else gets to know the key, it is not safe any more. Symmetric algorithms have the advantage of not consuming too much computing power. A few well-known examples are: DES, Triple-DES (3DES), IDEA, CAST5, BLOWFISH, TWOFISH.&lt;br/&gt;&lt;br/&gt;Asymmetric algorithms use pairs of keys. One is used for encryption and the other one for decryption. The decryption key is typically kept secretly, therefore called ``private key&#39;&#39; or ``secret key&#39;&#39;, while the encryption key is spread to all who might want to send encrypted messages, therefore called ``public key&#39;&#39;. Everybody having the public key is able to send encrypted messages to the owner of the secret key. The secret key can&#39;t be reconstructed from the public key. The idea of asymmetric algorithms was first published 1976 by Diffie and Hellmann.&lt;br/&gt;&lt;br/&gt;Asymmetric algorithms seem to be ideally suited for real-world use: As the secret key does not have to be shared, the risk of getting known is much smaller. Every user only needs to keep one secret key in secrecy and a collection of public keys, that only need to be protected against being changed. With symmetric keys, every pair of users would need to have an own shared secret key. Well-known asymmetric algorithms are RSA, DSA, ELGAMAL.&lt;br/&gt;&lt;br/&gt;However, asymmetric algorithms are much slower than symmetric ones. Therefore, in many applications, a combination of both is being used. The asymmetric keys are used for authentication and after this has been successfully done, one or more symmetric keys are generated and exchanged using the asymmetric encryption. This way the advantages of both algorithms can be used. Typical examples of this procedure are the RSA/IDEA combination of PGP2 or the DSA/BLOWFISH used by GnuPG.&lt;/p&gt;in reference to: &lt;p&gt;&lt;blockquote&gt;&quot;Symmetric vs. asymmetric algorithms When using symmetric algorithms, both parties share the same key for en- and decryption. To provide privacy, this key needs to be kept secret. Once somebody else gets to know the key, it is not safe any more. Symmetric algorithms have the advantage of not consuming too much computing power. A few well-known examples are: DES, Triple-DES (3DES), IDEA, CAST5, BLOWFISH, TWOFISH. Asymmetric algorithms use pairs of keys. One is used for encryption and the other one for decryption. The decryption key is typically kept secretly, therefore called ``private key&#39;&#39; or ``secret key&#39;&#39;, while the encryption key is spread to all who might want to send encrypted messages, therefore called ``public key&#39;&#39;. Everybody having the public key is able to send encrypted messages to the owner of the secret key. The secret key can&#39;t be reconstructed from the public key. The idea of asymmetric algorithms was first published 1976 by Diffie and Hellmann. Asymmetric algorithms seem to be ideally suited for real-world use: As the secret key does not have to be shared, the risk of getting known is much smaller. Every user only needs to keep one secret key in secrecy and a collection of public keys, that only need to be protected against being changed. With symmetric keys, every pair of users would need to have an own shared secret key. Well-known asymmetric algorithms are RSA, DSA, ELGAMAL. However, asymmetric algorithms are much slower than symmetric ones. Therefore, in many applications, a combination of both is being used. The asymmetric keys are used for authentication and after this has been successfully done, one or more symmetric keys are generated and exchanged using the asymmetric encryption. This way the advantages of both algorithms can be used. Typical examples of this procedure are the RSA/IDEA combination of PGP2 or the DSA/BLOWFISH used by GnuPG.&quot;&lt;br/&gt;- &lt;a href=&#39;http://www.suse.de/~garloff/Writings/mutt_gpg/node3.html&#39;&gt;Symmetric vs. asymmetric algorithms&lt;/a&gt; (&lt;a href=&#39;http://www.google.com/sidewiki/entry/raavikalyan/id/Oz0w9bDEzx_jTlACp1a2JMj9Rx4&#39;&gt;view on Google Sidewiki&lt;/a&gt;)&lt;/blockquote&gt;&lt;/p&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/6800067931659289444/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/6800067931659289444' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/6800067931659289444'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/6800067931659289444'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2010/01/symmetric-vs-asymmetric-algorithms.html' title='Symmetric vs. asymmetric algorithms'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-4807122987789720315</id><published>2008-03-13T01:03:00.000-07:00</published><updated>2008-03-13T01:04:08.096-07:00</updated><title type='text'></title><content type='html'>&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--&lt;br /&gt;google_ad_client = &quot;pub-6393546909325081&quot;;&lt;br /&gt;/* 468x60, created 3/13/08 */&lt;br /&gt;google_ad_slot = &quot;2306850765&quot;;&lt;br /&gt;google_ad_width = 468;&lt;br /&gt;google_ad_height = 60;&lt;br /&gt;google_cpa_choice = &quot;&quot;; // on file&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;script type=&quot;text/javascript&quot;&lt;br /&gt;src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;&lt;br /&gt;&lt;/script&gt;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/4807122987789720315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/4807122987789720315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/4807122987789720315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/4807122987789720315'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2008/03/blog-post.html' title=''/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6571685536547255639.post-2020444385059532950</id><published>2007-07-11T08:24:00.000-07:00</published><updated>2007-07-11T08:38:00.519-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Paul Schaeflein"/><title type='text'>An Introduction to Microsoft SharePoint Portal Server</title><content type='html'>&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;As the volume of intranet content grows, administrators and users are increasingly looking for ways to manage the volume of information. Just as Netscape aggregated the then-growing internet content into a manageable framework (called a portal), application vendors have created many packages that allow their customers to aggregate their intranet content into corporate portals. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;This series of articles will discuss Microsoft&#39;s portal product — SharePoint Portal Server. I hope to provide some value to the readers of Intranet Journal regarding the capabilities (and limitations) of SharePoint. Your feedback is encouraged, and will help me to cover topics that you find relevant. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;Introduction to SharePoint&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;Like most portal products, SharePoint allows visitors to create custom views of the Web site. This customization can be very simple or very complex, depending on the type and version of the product that is installed. In addition, SharePoint has a powerful collaboration model that is tightly integrated with the Office 2003 suite. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;The current version of SharePoint is its third (despite its name). Like most Microsoft software, (Windows in particular) version 3 is gaining rapid adoption. A &lt;a href=&quot;http://www.theregister.co.uk/2005/01/27/office_update/&quot;&gt;recent article&lt;/a&gt; in &lt;i&gt;The Register&lt;/i&gt; indicated that SharePoint Portal Server is Microsoft&#39;s fastest growing product, with 30 million licenses. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;History of SharePoint&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;Microsoft&#39;s first portal application was called Digital Dashboard. This product introduced the concept of Web parts — boxes of information on a page that represented a summary or overview of information. (Other vendors referred to these items as &quot;portlets.&quot;) By assembling multiple parts on a page, each user could customize his view of the portal to contain the information that pertained to them. In theory, every visitor of the site could have different content at the same URL. However, the technology behind the Digital Dashboard was not up to the task, and it never made it out of the beta stage. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;At the same time, Microsoft&#39;s Office group was working toward a collaboration solution. The need for many people to contribute to a single document or worksheet was growing. And, these people were not necessarily working at the same location. The result was SharePoint Team Services (STS), a Web-based solution that allowed shared access to information and documents. STS also allowed end-users to make changes to the site via a Web browser instead of requiring a development-oriented application. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;The merging of the collaboration and aggregation functions lead to SharePoint Portal Server 2001. Portal Server has been upgraded to run on the .Net framework and is now referred to as SharePoint Products and Technologies. The &quot;Product&quot; is SharePoint Portal Server 2003 (SPS) and the &quot;Technologies&quot; are Windows SharePoint Services (WSS). A significant point about these two is that WSS is included with the Windows Server 2003 license. Any organization that is licensed for Windows Server 2003 can also host Websites that are based on WSS. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;Features of SharePoint&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;In general, SharePoint contains all of the features you would expect from a portal or collaboration tool: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;li&gt;Browser-based customization of page &lt;/li&gt;&lt;li&gt;Browser-based content administration &lt;/li&gt;&lt;li&gt;Aggregation capabilities &lt;/li&gt;&lt;li&gt;Document Repository &lt;/li&gt;&lt;li&gt;Message board &lt;/li&gt;&lt;li&gt;Ad-hoc data storage &lt;/li&gt;&lt;li&gt;E-mail notifications &lt;/li&gt;&lt;li&gt;Announcements, event calendar and contact list. &lt;/li&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ul&gt; &lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;A complete feature matrix that also indicates whether the feature is part of WSS or SPS can be found in the whitepaper &lt;i&gt;Implementing Rich Collaboration Infrastructure Using Windows SharePoint Services and SharePoint Portal Server 2003&lt;/i&gt; on Microsoft&#39;s Web site (&lt;a href=&quot;http://www.microsoft.com/sharepoint/evaluationoverview.asp&quot;&gt;http://www.microsoft.com/sharepoint/evaluationoverview.asp&lt;/a&gt;). &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;Uses for SharePoint&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;In addition to being the default intranet portal, there are many additional uses for SharePoint. Microsoft has included pre-defined templates for Web sites to facilitate meetings, manage projects and create documents. Combined with the &quot;self-service&quot; site creating feature, teams can create and use a Web site with minimal assistance from the Information Technology department. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;The Document Workspace template will allow a group to work on a document. The template combines a document repository with a task list and a links list. While using Word 2003, a user can have the document open and at the same time view the task or links list. Changes made to the task list are immediately visible to site visitors. And the document library allows versioning, so edits are not lost. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;The Meeting Workspace template combines the agenda, attendee list and Outlook&#39;s calendar function. When sending a meeting request in Outlook 2003, a user can create a workspace on the server. The URL of the workspace is automatically included in the message and the attendees are added to the site. The materials required for the meeting can be centrally located, which is preferable for attendees who travel frequently. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;The browser-based customization feature, combined with the ability to create ad-hoc lists allows an advanced user to create a site for almost any purpose. A user group could host its meeting schedule, complete handouts. A youth sport organization can post its schedule and roster. An individual can host a blog. The possibilities are endless. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;About this series&lt;/b&gt;&lt;br /&gt;This series of articles on SharePoint is intended to help you understand the capabilities of the product, as well as provide tips and tricks, development ideas, information from Microsoft, information from the community, and perhaps some samples. Like many other series on IntranetJournal.com, I plan to include how-to articles that can help you with your deployments — ways to customize a page; deployment scenarios; content management; etc. With such a diverse product, there is no lack of topics for this series of articles. What would you like to read? &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;span style=&quot;font-family:Arial,Helvetica;&quot;&gt;&lt;span style=&quot;;font-family:Arial,Helvetica;font-size:85%;&quot;  &gt;&lt;b&gt;About the author&lt;/b&gt;&lt;br /&gt;Paul Schaeflein is a developer with over twenty years experience. Paul has been developing dynamic and interactive Web sites since 1996. Paul has worked on all of the versions of SharePoint and has worked with the .Net framework since its debut. You can reach Paul through his blog at &lt;a href=&quot;http://www.schaeflein.net/blog/&quot;&gt;http://www.schaeflein.net/blog/&lt;/a&gt;. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://bytesforge.blogspot.com/feeds/2020444385059532950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/6571685536547255639/2020444385059532950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/2020444385059532950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6571685536547255639/posts/default/2020444385059532950'/><link rel='alternate' type='text/html' href='http://bytesforge.blogspot.com/2007/07/introduction-to-microsoft-sharepoint.html' title='An Introduction to Microsoft SharePoint Portal Server'/><author><name>Kalyan</name><uri>http://www.blogger.com/profile/03715768442192894457</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>