[srm-cvs] CVS Update: - Added the idiot guide to the CVS

From: <d.rethans[@]jdimedia.nl>
Date: Thu Jun 20 2002 - 09:36:50 CEST

Date: Thu Jun 20 09:36:50 CEST 2002
User: Derick Rethans
Directory: srmdoc/user

Log Message:
 [1.00]
 - Added the idiot guide to the CVS
 
Deleted files:
           srmdoc/article.dsl (last version: 1.1)
Modified files:
           srmdoc/.cvsignore (version: 1.3)
           srmdoc/Makefile.in (version: 1.7)
           srmdoc/configure.in (version: 1.3)
           srmdoc/print.dsl (version: 1.2)
           srmdoc/articles/php-almanac-2002.xml (version: 1.7)
           srmdoc/user/faq.xml (version: 1.6)
Added files:
           srmdoc/article.dsl.in (new version: 1.1)
           srmdoc/articles/idiot-guide.xml (new version: 1.1)

[FILE: /srmdoc/article.dsl.in]

<!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
<!ENTITY docbook.dsl SYSTEM "@DOCBOOK_HTML@" CDATA DSSSL>
<!ENTITY html-common.dsl SYSTEM "@srcdir@/html-common.dsl">
<!ENTITY common.dsl SYSTEM "common.dsl">
<!ENTITY version.dsl SYSTEM "./version.dsl">
]>

<!--

  $Id: cvstemp,v 1.1 2002/06/20 07:36:48 derick Exp $

  HTML-specific stylesheet customization for use by the online manual.

-->

<style-sheet>
<style-specification id="docbook-php-website" use="docbook">
<style-specification-body>

(declare-flow-object-class processing-instruction
  "UNREGISTERED::James Clark//Flow Object Class::processing-instruction")

(define %html-ext% ".php")
(define %html-manifest% "PHPWEB.manifest")
(define %output-dir% "html/articles")

;; XXX hackish workaround. I'm not sure what side effects setting
;; the element number to 0 would have?
(define (generate-anchor #!optional (nd (current-node)))
  (string-append "AEN" (number->string (or (all-element-number nd) 0))))

(define (phpweb-quote str)
  (string-replace str "'" "\\'"))

(define (phpweb-header #!optional (nd (current-node)))
    (php-code
     (string-append
      newline
      "include('include/header.inc');" newline
      "include('include/footer.inc');" newline
      (phpweb-header-navigation nd) newline
      "page_header ('SRM - Article', '');" newline
)))

(define (phpweb-footer #!optional (nd (current-node)))
  (php-code
   (string-append
; "manualFooter('" (phpweb-quote (phpweb-node-title nd)) "','" (phpweb-quote (html-base-filename nd)) "');" newline
     "footer (''); " newline
)))

(define (phpweb-node-title #!optional (nd (current-node)) (title-elem "title"))
  (let* ((preferred-title-node
          (cond ((equal? (gi nd) "refentry")
                 (node-list-first
                  (select-elements
                   (children
                    (select-elements (children nd) "refnamediv"))
                   "refname")))
                (else
                 (node-list-first
                  (select-elements (children nd) title-elem)))))
         (title-node
          (if (node-list-empty? preferred-title-node)
              (select-elements (children nd) "title") ;; fallback
              preferred-title-node)))
    (data title-node)))
               
(define (phpweb-header-nav-array nd)
  (let ((href (href-to nd))
        (title (phpweb-quote (phpweb-node-title nd "titleabbrev"))))
    (string-append
     "array('" href "', '" title "')")))
   
(define (phpweb-node-list-map func ndl)
  (let* ((node (node-list-first ndl))
         (rest (node-list-rest ndl))
         (item (func node)))
    (if (node-list-empty? rest)
        (list item)
        (append (list item) (phpweb-node-list-map func rest)))))

(define (phpweb-header-navigation nd)
  (let ((prev (prev-chunk-element nd))
        (next (next-chunk-element nd))
        (up (parent nd))
        (home (sgml-root-element))
        (toc-nodes (siblings (chunk-parent nd))))
    (string-append

     "$Navigation = array(" newline
     " 'home' => " (phpweb-header-nav-array home) "," newline
     " 'prev' => " (phpweb-header-nav-array prev) "," newline
     " 'next' => " (phpweb-header-nav-array next) "," newline
     " 'up' => " (phpweb-header-nav-array up) "," newline
     " 'toc' => array(" newline
     (join
      (phpweb-node-list-map (lambda (nnl)
                              (string-append
                       " "
               (phpweb-header-nav-array nnl)))
                            toc-nodes)
      (string-append "," newline))
     ")); "
     )))
    
 
(define (html-document title-sosofo body-sosofo)
  (let ((doc-sosofo
         (if (or (chunk?) (node-list=? (current-node) (sgml-root-element)))
             (make sequence
                   (phpweb-header (current-node))
                   body-sosofo
                   (phpweb-footer (current-node)))
             body-sosofo)))
    (if (chunk?)
        (make entity
              system-id: (html-entity-file (html-file))
              doc-sosofo)
        doc-sosofo)))

(element programlisting
        (make processing-instruction
                data: (string-append "php highlight_string ('" (string-replace (data (current-node)) "'" "\\'") "'); ?"))
)

(define ($section-separator$)
  (let* (;; There are several situations in which we don't want a
         ;; separator here:
         ;; 1. This document is being chunked:
         (chunks (not nochunks))
         ;; 2. This node is the root element of the document:
         (isroot (node-list=? (current-node) (sgml-root-element)))
         ;; 3. This node is the first section in the root element
         ;; and no other content (except the *info elements and
         ;; the title) precedes it. This means that the
         ;; titlepage-separator was the last thing we put out.
         ;; No one expects two separators in a row, or the Spanish
         ;; inquisition.
         (s1ofrt (node-list=? (parent (current-node)) (sgml-root-element)))
         (precnd (ipreced (current-node)))
         (infond (info-element (parent (current-node))))
         (isfirst (or (equal? (gi precnd) (normalize "title"))
                      (node-list=? precnd infond))))
        (if (or chunks isroot isfirst)
        (empty-sosofo)
        (literal "")
   )))

(element acronym
  (make element gi: "ACRONYM"
    attributes: (list
             (list "TITLE" (normalize (attribute-string (normalize "title")))))
    (process-children)))

(define ($section-body$)
  (make element gi: "DIV"
    attributes: (list (list "CLASS" (gi)))
    ($section-title$)
    (process-children)
    ($section-separator$)))

(define
        (article-titlepage-separator side)
        (make empty-element
                gi: "IMG"
                attributes: (list
                        (list "BORDER" "0")
                        (list "SRC" "/images/black.gif")
                        (list "WIDTH" "100%")
                        (list "HEIGHT" "1")
                )
        )
)

(mode article-titlepage-recto-mode
  (element revhistory
    (make element gi: "DIV"
      attributes: (list (list "CLASS" (gi)))
      (make element gi: "TABLE"
        attributes: (list
                 (list "WIDTH" ($table-width$))
                 (list "CELLSPACING" "0")
                 (list "BORDER" "0"))
        (make sequence
          (make element gi: "TR"
            (make element gi: "TH"
                  attributes: '(("ALIGN" "LEFT")
                        ("VALIGN" "TOP")
                        ("COLSPAN" "3"))
                  (make element gi: "B"
                    (literal (gentext-element-name
                          (gi (current-node)))))))
          (process-children)))))

  (element (revhistory revision)
    (let ((revnumber (select-elements (descendants (current-node))
                                      (normalize "revnumber")))
          (revdate (select-elements (descendants (current-node))
                                      (normalize "date")))
          (revauthor (select-elements (descendants (current-node))
                                      (normalize "authorinitials")))
          (revremark (select-elements (descendants (current-node))
                                      (normalize "revremark"))))
      (make sequence
      (make element gi: "TR"
        (make element gi: "TD"
              attributes: (list
                           (list "ALIGN" "LEFT"))
              (if (not (node-list-empty? revnumber))
                  (make sequence
                    (literal (gentext-element-name-space
                              (gi (current-node))))
                    (process-node-list revnumber))
                  (empty-sosofo)))
        (make element gi: "TD"
              attributes: (list
                           (list "ALIGN" "LEFT"))
              (if (not (node-list-empty? revdate))
                  (process-node-list revdate)
                  (empty-sosofo)))
            (make element gi: "TD"
                  attributes: (list
                               (list "ALIGN" "LEFT")
                               (list "WIDTH" "70%")
                                        )
                  (if (not (node-list-empty? revremark))
                      (process-node-list revremark)
                      (empty-sosofo)))))))
)

&html-common.dsl;
&common.dsl;
&version.dsl;

</style-specification-body>
</style-specification>
<external-specification id="docbook" document="docbook.dsl">
</style-sheet>

<!--
Local Variables:
mode: scheme
End:
-->

[FILE: /srmdoc/.cvsignore]

--- srmdoc/.cvsignore:1.2 Sun Feb 10 18:22:51 2002 GMT
+++ srmdoc/.cvsignore Thu Jun 20 05:36:48 2002 GMT
@@ -8,5 +8,6 @@
 html.dsl
 Makefile
 phpweb.dsl
+article.dsl
 *.chm
 *.tar.gz

[FILE: /srmdoc/Makefile.in]

--- srmdoc/Makefile.in:1.6 Thu Apr 18 11:03:49 2002 GMT
+++ srmdoc/Makefile.in Thu Jun 20 05:36:48 2002 GMT
@@ -13,8 +13,7 @@
 PRINT_STYLESHEET=print.dsl
 QUICKREF_STYLESHEET=quickref.dsl
 KDEVELOP_TOC_STYLESHEET=kdevelop_toc.dsl
-ARTICLES_HTML=html/articles/php-almanac-2002.php
-ARTICLES=articles/php-almanac-2002.xml
+ARTICLES=articles/php-almanac-2002.xml articles/idiot-guide.xml
 
 HTML_DEPS=$(HTML_STYLESHEET) common.dsl
 PHPWEB_DEPS=$(PHPWEB_STYLESHEET) common.dsl

[FILE: /srmdoc/configure.in]

--- srmdoc/configure.in:1.2 Mon Feb 04 19:02:53 2002 GMT
+++ srmdoc/configure.in Thu Jun 20 05:36:48 2002 GMT
@@ -1,4 +1,4 @@
-dnl $Id: cvstemp,v 1.2 2002/02/04 20:02:53 derick Exp $
+dnl $Id: cvstemp,v 1.3 2002/06/20 07:36:48 derick Exp $
 
 AC_INIT()
 
@@ -178,7 +178,7 @@
 
 AC_SUBST(CATALOG)
 
-AC_OUTPUT(Makefile html.dsl phpweb.dsl)
+AC_OUTPUT(Makefile html.dsl phpweb.dsl article.dsl)
 
 dnl sanity checks for SuSE 6.x
 if test -e /usr/share/sgml/docbk30/docbook.dcl

[FILE: /srmdoc/print.dsl]

--- srmdoc/print.dsl:1.1 Mon Feb 04 20:10:32 2002 GMT
+++ srmdoc/print.dsl Thu Jun 20 05:36:48 2002 GMT
@@ -1,5 +1,5 @@
 <!DOCTYPE style-sheet PUBLIC "-//James Clark//DTD DSSSL Style Sheet//EN" [
-<!ENTITY docbook.dsl SYSTEM "/usr/lib/sgml/stylesheets/nwalsh-modular/print/docbook.dsl" CDATA DSSSL>
+<!ENTITY docbook.dsl SYSTEM "/usr/share/sgml/docbook/dsssl-stylesheets-1.59//print/docbook.dsl" CDATA DSSSL>
 <!ENTITY common.dsl SYSTEM "common.dsl">
 <!ENTITY pdflevels.dsl SYSTEM "pdflevels.dsl">
 <!ENTITY version.dsl SYSTEM "version.dsl">
@@ -7,7 +7,7 @@
 
 <!--
 
- $Id: cvstemp,v 1.1 2002/02/04 21:10:32 derick Exp $
+ $Id: cvstemp,v 1.2 2002/06/20 07:36:48 derick Exp $
 
   This file contains printout-specific stylesheet customization.
 

[FILE: /srmdoc/articles/idiot-guide.xml]

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
          "../dbxml/docbookx.dtd" [

  <!ENTITY % srmdoc.defs SYSTEM "../global.ent">
  %srmdoc.defs;
]>
<!-- $Revision: 1.1 $ -->
<article>
 <articleinfo>
  <author>
   <firstname>Jonathan</firstname>
   <surname>Arkell</surname>
  </author>
  <authorinitials>ja</authorinitials>
  <title>An Idiots Guide to Insalling SRM</title>
  <titleabbrev>SRM Idiots Guide</titleabbrev>
  <revhistory>
   <revision>
    <revnumber>1.0</revnumber>
    <date>18 May 2002</date>
    <authorinitials>ja</authorinitials>
    <revremark>First version</revremark>
   </revision>
   <revision>
    <revnumber>1.0.1</revnumber>
    <date>20 June 2002</date>
    <authorinitials>dr</authorinitials>
    <revremark>
     Updated docbook tags, small adjustsments to changes in
     version requirements
    </revremark>
   </revision>
  </revhistory>
 </articleinfo>
 
 <section id="intro">
  <title>Introduction</title>
  <para>
   As a programmer, and primarily a Web programmer, I had a difficult time
   compiling SRM, and making it go, The purpose of this document is to give a
   hand to all the PHP programmers out there who have wanted exactly that
   which SRM provides, but who perhaps lack experience in being able to
   compile and install PHP. If you are comfortable with installing and
   compiling PHP, than chances are this document is not for you (you might
   however, find the pitfalls and tips section edifying)
  </para>
  
  <section id="intro.requirements">
   <title>What you will need</title>
   <itemizedlist>
    <listitem>
     <para>
      Patience
     </para>
    </listitem>
    
    <listitem>
     <para>
      The CVS version of SRM, as well as PHP CVS version 4.3 or greater
      (the sources)
     </para>
    </listitem>
    
    <listitem>
     <para>
      autoconf 2.52, automake 1.4 or automake 1.5, libtool 1.4. (you need
      these to build the PHP CVS version)
     </para>
    </listitem>
    
    <listitem>
     <para>
      The will to install and test this thing. This is beta software, and it
      does take some tweaking. If you are Joe Server Admin, chances are you
      already know what you are doing, and know exactly how to do this. If
      you are Fred Webguy on the other hand... there might be pain involved.
     </para>
    </listitem>
    
    <listitem>
     <para>
     The ability to read docs! All kinds of docs! If you try these
     instructions, and it breaks, than read the instillation docs, from the
     web, in the source directory...everywhere.
     </para>
    </listitem>
   </itemizedlist>
  </section>
  
  <section id="intro.otherhelp">
   <title>Where to go for more help</title>

   <para>
    if you have an IRC client, you can always hop onto EFNet and ask around in
    channel #vl-srm
   </para>
   <para>
    You can also join the <ulink
    url="http://www.vl-srm.net/doc/support.php">mailing list</ulink>
   </para>
  </section>
  
  <section id="intro.thanks">
   <title>Thanks you's</title>
   <itemizedlist>
    <listitem>
     <para>Everyone in #vl-srm who helped me out.</para>
    </listitem>
    <listitem>
     <para>
      Zak Greant and Trevor "Skinneet" for helping make this document better.
     </para>
    </listitem>
   </itemizedlist>
  </section>
 </section>
 
 <section id="starting">
  <title>Starting Out</title>
  
  <para>
   SRM has 3 components to it. The first being the SRM daemon
   itself, the second being the Zend Engine for the SRM daemon, and the
   third being the extension for the version of PHP that runs on your
   web server.
  </para>
 
  <para>
   So that means compiling 3 times. You will end up compiling the
   SRM source once, and the PHP source Twice.
  </para>

  <para>
   First, you need to get the SRM Sources .. They are available via CVS, and
   all the pertinent details are right here at <ulink
   url="http://www.vl-srm.net/download.php">
   http://www.vl-srm.net/download.php</ulink>
  </para>
 
  <para>
   I checked everything out into /usr/local/src/srm-CVS .. assuming you did
   the same thing, you should have a directory structure like this:
  </para>
 
  <screen>
  /usr/local/src/srm-CVS
      |
      +-- php_srm
      |
      +-- sapi_srm
      |
      +-- srm
  </screen>
 </section>
 
 <section id="compiling">
  <title>Compiling and installing SRM</title>

  <section id="compiling.srm">
   <title></title>
   <para>
    This is actually rather easy, and I was able to compile the SRMD server,
    as well as the libraries with the least amount of pain.
   </para>
   
   <para>
    Its as easy as going to /usr/local/src/srm-CVS/srm and typing
    in the following things:
   </para>
   
   <programlisting>
./buildconf
   </programlisting>
   
   <para>
    Than let it do its thing. with any luck it will not spit out
    any errors at you.
   </para>
   
   <para>
    After that, you have to tell the compiler what kind of options
    you want with your copy of SRM. I started with just a basic
    debug config, and figured I would add to it once I got more
    comfortable with SRM.
   </para>
   
   <para>
    I found it extremely handy to write up a little script that
    handles my configure options. Mine is named srmdConfigure, and
    this is what it looks like.
   </para>
   
   <programlisting>
./configure --enable-debug
   </programlisting>
   
   <para>
    Pretty tiny huh? The reason why I did it this way tho, is so I know
    exactly what kind of configure options I built with srm. A full list of
    compile options is available here: <ulink
    url="http://www.vl-srm.net/doc/admin.compile.php">
    http://www.vl-srm.net/doc/admin.compile.php</ulink>
   </para>

   <para>now, run that little script</para>

   <programlisting>
./srmdConfigure
   </programlisting>

   <para>
    The next thing to do is to make the thing. This is pretty easy. Just
    type:
   </para>
   
   <programlisting>
make
   </programlisting>

   <para>
    This compiles everything.
   </para>

   <para>
    After that, all you have to do is Install it. That's as easy
    as typing in:
   </para>

   <programlisting>
make install
   </programlisting>
   
   <para>
    The final thing that you need to do is deal with the srm.ini. First put
    it in /etc. If you can't find it.. it is probably located in
    /usr/local/srm/sbin. If you still can't find it, try:
   </para>

   <programlisting>
find / -name 'srm.ini'
   </programlisting>

   <para>
    Finally, you should edit the srm.ini file, and set up all the options. If
    you ended up using the srmdConfigure script, you will need to turn off the
    'load "auth";' and 'load "http";' lines, by putting a # in front of it.
    (I've included my own srm.ini so you can have a look). You can also
    change the banana classpath (which is where all your banana's will live,
    as you can see, i put mine in /var/srm/ ) and the function_library.
   </para>

   <para>
    One quick note. You will have to make sure that the PHP file that is your
    function library exists. (that's OK, it can be a PHP file that looks
    like &lt;?php ?&gt;). You might want to use the one I have provided
    called "library.php", this will help in testing your SRM installation.
   </para>

   <warning>
    <para>
     If you ever need to compile SRM again... which, hopefully you wont, be
     sure to run <programlisting>make clean</programlisting> and
     <programlisting>make distclean</programlisting> BEFORE you do anything
     else.
    </para>
    <para>
     You will not have to do the buildconf step again.
    </para>

    <para>
     (is another ./configure necessary? I am not sure to be honest. I always
     did it though. Better safe than sorry.)
    </para>
   </warning>
   
   <para>
    What did you just do? You just compiled the SRM Daemon (programmed in C)
    that will handle the raw requests from your PHP scripts on the web server.
    the SRM Daemon can't run PHP scripts yet.
   </para>
  </section>

  <section id="compiling.sapi_srm">
   <title>Making SRM Speak PHP</title>
   <para>
    SRM will only work with PHP 4.3.0 and higher, you need to get the source
    for this version from CVS.
   </para>

   <para>
    Anonymous CVS access to PHP is available here: <ulink
    url="http://www.php.net/anoncvs.php">http://www.php.net/anoncvs.php</ulink>
   </para>
     
   <para>
    First you need to copy the SAPI (sapi_srm), and the
    extension (php_srm) sources of SRM into your PHP source
    directory.
   </para>

   <para>
    Assuming your PHP source lives in /usr/local/src/php4 it is as
    simple as
   </para>
   <programlisting>
cp -R /usr/local/src/srm/php_srm /usr/local/src/php4/ext/
mv /usr/local/src/php4/ext/php_srm /usr/local/src/php4/ext/srm
   </programlisting>
   <para>
    (this copies the SRM extension into PHP's extension directory)
    next, you need to copy the SAPI... and you guessed it..
   </para>
   <programlisting>
cp -R /usr/local/src/srm/sapi_srm /usr/local/src/php4/sapi/
mv /usr/local/src/php4/sapi/sapi_srm /usr/local/src/php4/sapi/srm
   </programlisting>
   
   <warning>
    <title>DO NOT SYMLINK!</title>
    <para>
     I know it seems like a good idea to just make a symlink
     in the php4 directory to the srm_sapi and php_srm directory,
     but its not! Apparently &quot;make clean&quot; does not
     clean out symlinked directories.
    </para>
   </warning>

   <para>
    Remove the configure file that is in your /usr/local/src/php4
    directory:
   </para>
   <programlisting>
rm configure
   </programlisting>
   <para>
    than you want to do a
   </para>
   <programlisting>
./buildconf
   </programlisting>
   <para>
    in the php4 directory. This builds the php4 configure.
   </para>
    
   <para>
    If you want to test and make sure you can build PHP with the
    SRM modules, by doing this:
   </para>
   <programlisting>
./configure --help | grep srm
   </programlisting>
   <para>
    and you should see (something like ) this:
   </para>

   <screen>
--with-srm-sapi[=DIR] Include SRM-SAPI support
--with-srm[=DIR] Include SRM: Script Running Magic (http://www.vl-srm.net/) support
--with-tsrm-pth[=pth-config] Use GNU Pth.
--with-tsrm-st
--with-tsrm-pthreads Use POSIX threads (default)
   </screen>

   <para>
    If not, you haven't got the srm SAPI and/or the SRM extension
    in the php4/sapi and php4/ext sections of your source.
   </para>
   
   <para>
    After it is done, we need to configure PHP 4. This is where I
    found the use of a script extremely beneficial. Because if this
    step breaks, and you have to do this all over again, its just
    right here for you.
   </para>
   
   <para>
    It also makes adding new modules very easy. So which much
    further ado, here is my configure script, I called it
    sapiConfigure.
   </para>
   
   <para>
    An important thing to realize is that SRM doesn't officially
    support shared modules.. and it is &quot;not a good idea to use
    shared modules with SRM&quot;. I would just follow that
    advice.
   </para>

   <programlisting>
./configure \
--with-srm-sapi=/usr/local/srm \
--with-srm=/usr/local/srm \
--with-layout=GNU \
--disable-static \
\
--enable-memory-limit \
--enable-track-vars \
--enable-debug \
--with-config-file-path=/etc/php4/srm \
\
--with-mysql=/usr \
#--with-exif \
#--enable-bcmath \
   </programlisting>

   <para>
    I am not going to go into every line by line detail, you can find out what
    is going on by checking out <ulink
    url="http://www.php.net/manual/en/install.configure.php">
    http://www.php.net/manual/en/install.configure.php </ulink>.
   </para>
   
   <para>
    In case you don't know, the \ 's in the script, tell your
    shell (hopefully) that even tho there is a CR at the end of
    this line, don't interpret the code right away.
   </para>

   <para>
    At the end of the file, there is a bunch of options
    commented out ( i.e. #--with-exif) These are options that I
    may or may not want to add in the future. If you want to
    add modules to the SRM PHP engine, go ahead, But don't just
    un-comment them out! make sure that all the commented out
    config options stay together... i.e.
   </para>

   <para>
    This is correct:
   </para>
   <programlisting>
./configure \
--with-srm-sapi=/usr/local/srm \
(...)
--with-config-file-path=/etc/php4/srm \
\
--with-mysql=shared,/usr \
--enable-bcmath \
#--with-exif \
   </programlisting>

   <para>
    This is WRONG! (and will break your sapiConfigure script):
   </para>
   
   <programlisting>
./configure \
--with-srm-sapi=/usr/local/srm \
(...)
--with-config-file-path=/etc/php4/srm \
\
--with-mysql=shared,/usr \
#--with-exif \
--enable-bcmath \
   </programlisting>

   <para>
    Why does this break things? Because when your shell
    interpreter runs into the first comment .. it assumes that
    your multi-line command is finished... when really its
    not.
   </para>
   
   <para>
    Also, make sure that the --with-srm and --with-srm-sapi
    options have =/usr/local/srm after them (like I do), Your
    milage might very if you used the --prefix option, in
    compiling SRM.
   </para>
   
   <para>
    You are compiling the SRM-SAPI (basically the thing that
    makes SRM speak in PHP) library. You are also compiling in
    the SRM extension because the server needs some functions it
    provides to run. So just to re-iterate, you are compiling
    both the SRM extension and the SRM-SAPI extension for the
    SRM-SAPI library. (phew)
   </para>
   
   <para>
    Now, weather you think you need it or not, do this!
    <programlisting>make clean</programlisting> and
    <programlisting>make distclean</programlisting>
    because we are going to have to rebuild PHP for your web
    server (later).
   </para>

   <section id="compiling.sapi_srm.problems">
    <title>Problems with compiling?</title>
    <itemizedlist>
     <listitem>
      <para>
       Try removing some of your ./configure
       options, and do a basic, what-you-need
       compile.
      </para>
     </listitem>
     <listitem>
      <para>
       Make sure you have the proper versions of autoconf, automake and
       libtool! If you have Debian Woody in fact, the stock libtool WILL shaft
       you. (recompiling and installing the proper version isn't hard at
       all) You can find out what you need from here: <ulink
       url="http://www.php.net/anoncvs.php">http://www.php.net/anoncvs.php</ulink>
      </para>
     </listitem>
    </itemizedlist>
   </section>
   
   <section id="compiling.sapi_srm.test">
    <title>Testing everything so far</title>
    <para> If you are semi-paranoid like me, you like to test stuff.
     So here is how to test SRM and make sure it worked.</para>

    <para>
     If you compiled srmd with --enable-debug than do this:
    </para>
    <programlisting>
/usr/local/srm/sbin/srmd
    </programlisting>
    <para>
     Otherwise, do this:
    </para>
    <programlisting>
/usr/local/srm/sbin/srmd -L
    </programlisting>

    <para>
     You should see something like this:
     <screen>
2002-05-08 13:34:27 [Log] Logfile opened (level 100)
2002-05-08 13:34:27 [--------] ------------------------------------------------
2002-05-08 13:34:27 [Module] Standard function module
2002-05-08 13:34:27 [Module] Version: 0.6.1
2002-05-08 13:34:27 [Module] Vendor: Vulcan Logic Group
2002-05-08 13:34:27 [Module] Description:
2002-05-08 13:34:27 [Module] SRM API version: 6010
2002-05-08 13:34:27 [Module] Loading functions...
2002-05-08 13:34:27 [Module] Addr: 080530A0
2002-05-08 13:34:27 [Func] - Loaded srm_version
2002-05-08 13:34:27 [Func] - Loaded srm_function_list
2002-05-08 13:34:27 [Func] - Loaded srm_function_exists
2002-05-08 13:34:27 [Func] - Loaded srm_module_list
2002-05-08 13:34:27 [Func] - Loaded srm_module_exists
2002-05-08 13:34:27 [Func] - Loaded srm_module_info
2002-05-08 13:34:27 [Func] - Loaded srm_application_keys
2002-05-08 13:34:27 [Func] - Loaded srm_session_keys
2002-05-08 13:34:27 [Func] - Loaded lock
2002-05-08 13:34:27 [Func] - Loaded unlock
2002-05-08 13:34:27 [--------] ------------------------------------------------
2002-05-08 13:34:27 [Module] Initializing module...
2002-05-08 13:34:27 [SRM-SAPI]
2002-05-08 13:34:27 [Module] - Module intialization OK.
2002-05-08 13:34:27 [Module] PHP 4 / Zend
2002-05-08 13:34:27 [Module] Version: 0.6.1
2002-05-08 13:34:27 [Module] Vendor: PHP Group
2002-05-08 13:34:27 [Module] Description: Scripting Language
2002-05-08 13:34:27 [Module] SRM API version: 6010
2002-05-08 13:34:27 [Module] Loading functions...
2002-05-08 13:34:27 [Module] Addr: 402CE538
2002-05-08 13:34:27 [Func] - Loaded start_banana
2002-05-08 13:34:27 [Func] - Loaded banana_function_call
2002-05-08 13:34:27 [Func] - Loaded get_loaded_bananas
     </screen>
    </para>
    
    <para>
     If you see this, (or something reasonably like it) it
     means that you have SRM working properly, and it will be
     able to speak PHP!
    </para>
   </section>
  </section>

  <section id="compiling.php_srm">
   <title>Serve Me up, Compiling PHP</title>
   <para>
    Did you <programlisting>make clean</programlisting> and
    <programlisting>make distclean</programlisting> in your php4 source
    directory yet? no? Bad admin! No Cookie!
   </para>
    
   <para>
    Now we have to build the srm client with the server module of choice.
    (probably Apache) this means leaving out the --with-srm-sapi option.
   </para>
   
   <para>
    If you are currently using a pre-built .deb or .rpm of PHP, you will want
    to make a quick phpinfo() page, and get the "Configure Command" setting,
    its the third option down. You can't miss it. Copy this, and save it
    somewhere. You might want to know why (for instance) half your scripts
    that required gd, curl, shmop, and any number of other modules don't work
    ;)
   </para>
   
   <para>
    Now, you probably want to write up another configure script..
    I called this one srmApacheConfigure, for obvious reasons. In
    this compile, we do not need to worry about shared modules, so
    if you use them, no worries!
   </para>

   <programlisting>
./configure \
--prefix=/usr \
--with-srm=/usr/local/srm \
--with-layout=GNU \
--disable-static \
\
--with-apxs=/usr/bin/apxs \
\
--with-config-file-path=/etc/php4/apache \
--enable-memory-limit \
--enable-track-vars \
\
--with-mysql=shared,/usr \
--with-curl \
--with-exif \
--enable-bcmath \
--enable-sockets \
   </programlisting>

   <para>
    OK, remember that configure line you grabbed? you want to compare
    that with what is here, specifically if there is a --prefix option
    (and what the directory is after it), as well as --with-layout, and
    --with-config-file-path. (if your previous version was a .deb, than
    you should be able to use this configure just fine.
   </para>

   <para>
    Additionally, the --with-apxs line may not be applicable to you at
    all, check out <ulink
    url="http://www.php.net/manual/en/install.configure.php#install.configure.options.servers">
    Configure Server Options</ulink>. Again, check your previous
    configure to see what it was before.
   </para>
   
   <para>
    Than, all you have to do is
   </para>
   <programlisting>
./srmApacheConfigure
make
make install
   </programlisting>
   <para>
    and you have PHP ready to talk to srm!
    If you did everything right, than all you need to do is
    restart your webserver!
   </para>
  </section>
 </section>

 <section id="Testing">
  <title>Testing Your Install</title>

  <para>
   Now you will want to test to make sure SRM is installed, and
   is running properly.
  </para>

  <para>
   The first test you should run, is to make sure that Apache's
   PHP has the SRM module installed.. so just run a phpinfo() page,
   and check it out. You should see SRM showing up in the modules
   list, with the funky volcano image. If you don't you have done
   something wrong. You will need to do a ./buildconf and
   ./srmApacheConfigure and recompile.
  </para>

  <para>
   The next test should be to make sure you can run Banana's and
   functions within SRM's copy of php. There are two files
   included in this package that will help you test out SRM, and
   make sure that it works. One is called uptime.php (which is a
   modification of the origignal uptime.php on the SRM website.)
   The other is called srm_test.php. You should make sure that
   Uptime.banana.php is installed on your Banana classpath, and
   that your function library points to library.php in this
   package.
  </para>

  <para>
   The first test you should perform is to see that SRM is
   running, and check to make sure its options are working just
   fine. That's what srm_info.php is all about. Visit that page
   (on your server) with a browser, and you should see "SRM server
   is running, and receiving connections", and a link to view the
   PHP info. Click that link and check to see that your PHP under
   SRM is working properly, and has all appropriate compile
   options.
  </para>

  <para>
   The second test is to make sure that banana's are working.
   Open up the uptime.php (in your browser), and you should see
   your servers uptime twice.
  </para>

  <para>
   That's it! You now have a fully working copy of SRM!
  </para>
 </section>

 <section id="faq">
  <title>WTF? (What the FAQ?)</title>
  <qandaset>
   <qandaentry>
    <question>
     <para>
      PHP throws an error that it can't start a session, but I
      didn't even use SRM's session handling functions at all!
      Whats going on?
     </para>
    </question>
    <answer>
     <para> Weather or not you use session handling, SRM itself does.
      What is going on is that php cannot use your session save
      handler, and you probably set it to something like "file"
      instead of "files" or "srm".</para>
    </answer>
   </qandaentry>
  </qandaset>
 </section>

 <section id="conclusion">
  <title>Thats All Folks!</title>
  <para>
   Hopefully you have found this little tutorial helpful. if you
   need to contact me for comments, corrections, don't hesitate, you
   can reach me via email at:
   <ulink url="mailto:jonny@sanriowasteland.net">
    jonny@sanriowasteland.net
   </ulink>
  </para>
  <para>
   My next tutorial will be on how to effectively program bananas,
   and little gotchas in banana's that you should watch out for.
  </para>
 </section>
</article>
<!-- $Log: cvstemp,v $
<!-- Revision 1.1 2002/06/20 07:36:49 derick
<!-- [1.00]
<!-- - Added the idiot guide to the CVS
<!-- -->

<!-- keep this comment at the end of the file
vim600: syn=xml fen fdm=syntax fdl=4 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->

[FILE: /srmdoc/articles/php-almanac-2002.xml]

--- srmdoc/articles/php-almanac-2002.xml:1.6 Sun May 19 05:44:14 2002 GMT
+++ srmdoc/articles/php-almanac-2002.xml Thu Jun 20 05:36:49 2002 GMT
@@ -311,7 +311,7 @@
     linkend="bananas.remote-objs">Bananas</link> it's a very powerful way to
     have persistent objects coupled with specific sessions. If you only need
     to have session accessible from multiple webservers, you should also take a
- look at <ulink url="http://http://www.mohawksoft.com/phoenix/">msession</ulink> which specifically
+ look at <ulink url="http://www.mohawksoft.com/phoenix/">msession</ulink> which specifically
     addresses this issue, and is totally optimized for this single feature.
    </para>
   </section>
@@ -648,7 +648,7 @@
  </section>
 
  <section id="about-me">
- <title>Conclusion</title>
+ <title>About the author</title>
   <para>
    <ulink url="http://www.jdimedia.nl/derick/">Derick Rethans</ulink> provides
    solutions for internet related problems. Working in his own company, he

[FILE: /srmdoc/user/faq.xml]

--- srmdoc/user/faq.xml:1.5 Thu Feb 21 02:10:55 2002 GMT
+++ srmdoc/user/faq.xml Thu Jun 20 05:36:49 2002 GMT
@@ -8,7 +8,6 @@
  </para>
 
  <qandaset>
-
   <qandaentry id="faq.language">
    <question>
     <para>
Received on Thu Jun 20 10:24:23 2002

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 04:00:03 CET