Random Shouts from the Engine Room Neal Pollack's Weblog

Friday Mar 02, 2007

Sun's Cool Stack SAMP Packages have been upgraded to version 1.1 and released for free download.[Read More]

Thursday Oct 19, 2006

Previously, I mentioned the CoolThreads Cool Stack of SAMP software for sparc.
Optimized Mysql, PHP, Apache2, and Perl packages prebuilt for your system.
Free to download.

These are now available on Solaris x86/64 also.   Get your copies here;
http://cooltools.sunsource.net/coolstack/index.html

Included are a 64 bit version of MySQL5.

Tuesday Sep 19, 2006

Solaris leads Linux in just about every category - security, scalability, compatibility, stability, function/features, debugging/observability, ZFS,  and price/performance.
One of my peers, Henry Zhao, shared this deeply detailed analysis by Dr. Nikolai Bezroukov;

      http://www.softpanorama.org/Articles/solaris_vs_linux.shtml

This is probably the most surefire way to overflow this blog with comments and flames :-)   Is it fair?  Is it accurate?
You decide.

In his e-mail forward to me, Henry states;
"This is by far the most comprehensive review article about 'Solaris vs Linux'. If it's too technical for you, just read the 'Conclusions' section.
Solaris leads Linux in just about every categories - security, scalability, competibility, stability, function/features, ZFS, price/performance.
With the OpenSolaris support of x86, Solaris is basically the only way to go if you are serious about your business."

It's a good read.  Enjoy it.

Sunday Sep 17, 2006

Solaris, Apache2, Mysql5, PHP5 (SAMP) just keeps getting better.    As pointed out by Shanti in a comment below, the
Sun PAE group decided to compile and benchmark highly optimized versions of the SAMP packages and post them for
download.   If you don't enjoy compiling software, or prefer to use optimized high-performing binary packages,
take a look at this web page;  http://cooltools.sunsource.net/coolstack/
Source is also provided for those who are curious about the options and methods used.

To quote from CoolStack features;
" Cool Stack includes several Sun Solaris OS packages, so you can install just the ones you need. Some of the applications in Cool Stack already ship with Sun Solaris OS 10, but these are either older versions and/or not built with full optimization. Cool Stack is built using Sun Studio (TM) 11 Compiler using the -xO4 option for high levels of optimization. This results in anywhere between 30-200% performance improvement (depending on workload/application) over standard compilations performed using gcc."

The group is currently working on an x86 version of CoolStack and hopes to release this in several weeks.
The new Studio-11 compilers are both amazing  and free.  Download and try here;
http://developers.sun.com/prodtech/cc/index.jsp

Thursday Sep 14, 2006

It marks an especially pleasant start to my day when Sun is able to cause pain for the competition.
This paragraph from the InfoWorld Daily Newsletter provided a few chuckles;

QUOTE OF THE DAY: SUN'S SERVER COUP

What really puts Intel in the doghouse is Sun's decision to open the
design of UltraSparc T1 for public use. It is the silicon equivalent of
open source, and it's no lip service. Inexpensive and readily available
programmable logic puts anyone a few hundred dollars away from being
able to mint their own 64-bit Sparc CPUs. Of course, it takes more than
that to make it do anything; but the point is that Sun has matched IBM
in opening its server processor technology. -- Tom Yager. Sun is winning
in the server market. ...


http://newsletter.infoworld.com/t?r=314&ctl=13F2216:388813189F355EBDEEDFFCF4BC66C939EFF29049075316B4

Wednesday Sep 13, 2006

 Continued from previous blog entry.  We will next edit configuration files and test the entire stack;

   H.  Edit the configuration files.


        * Edit the /etc/apache2/php.ini file to set PHP options.

          With PHP5, there is no longer any automatic loading of the mysql interface module.
          You need to explicitly cause it, and any other extention modules needed, to be
          loaded.  To do this, edit the php.ini file and add two lines;

          1.  Verify that your build of php5 did create the module you need;
              # ls -l /usr/local/lib/php/extensions/no-debug-non-zts-20050922/
              total 1088
              -rwxr-xr-x   1 root     root      103144 Aug 29 21:48 mysql.so
              -rwxr-xr-x   1 root     root      429948 Aug 29 21:48 mysqli.so

             Find the line(s) in php.ini that starts with;
               ; Directory in which the loadable extensions (modules) reside.
               extension_dir =
             and edit the line to become;
               extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20050922/"

             If you had installed PHP5 to another location, adjust the above line
             accordingly.

        2.  Next, find this block of the php.ini file;

              ;;;;;;;;;;;;;;;;;;;;;;
              ; Dynamic Extensions ;
              ;;;;;;;;;;;;;;;;;;;;;;

             and ADD the following line;

              extension=mysql.so

         Now, you will not go nuts trying to understand why your apache2/PHP5 can not
         connect to MySQL.

         3.  Next, Edit the /etc/apache2/httpd.conf file to load the PHP module.

         Find the line that contains "php5_module".
         The path on the right hand side of the LoadModule statement must point to the path of
         the PHP module on your system.  This path will be RELATIVE to /usr/apache2 on your system.
         (So it is really /usr/apache2/libexec/libphp5.so)
         The gmake install of PHP5 from above should have already added this for you,
          but be sure to check.

                 LoadModule php5_module libexec/libphp5.so

        We want to have Apache2 parse the .php extension for web page file names as PHP.
        Find the "AddType" section of your /etc/apache2/httpd.conf file, and add this line;

                AddType application/x-httpd-php .php

        Some users prefer to omit the above line from httpd.conf, and instead add

           'application/x-httpd-php php phtml'

        to the /etc/apache2/mime.types file.  Either way is fine.


    I.  Start Apache2 and Test.

        WARNING:  If you have activated apache 1.3 previously, either via other SAMP articles, the
        Companion CD scripts, or manually, a collision will result when you try to proceed below.
        * It is important to disable apache 1.3 before proceeding.

        Ensure that Apache 1.3 is disabled:
     
          #svcs -a | grep apache
          legacy_run     Sep_11   lrc:/etc/rc3_d/S50apache

        shows that a legacy rc startup script for apache 1.3 is /etc/rc3_d/S50apache.
        The script looks for the existance of a configuration file for apache at

          /etc/apache/httpd.conf

        and will not start apache 1.3 if the file is missing.  To disable apache 1.3, either ensure
        that there is no file at the above path, or (maybe a little extreme) rename the startup script from;

          /etc/rc3_d/S50apache

        to

         /etc/rc3.d/OFF-S50apache

        Only scripts that start with the letter "S" will actually be executed at startup time.

          START APACHE 2:
       
        # svcadm enable apache2
        # svcs | grep -i apache2
        online         18:07:10 svc:/network/http:apache2

        If Apache2 started successfully, you can use the "ps" command, and should see several
        processes similar to below;

        # ps -ef | grep http
        webservd 18592  3802   0   Sep 11 ?           0:03 /usr/apache2/bin/httpd -k start
        webservd 13093  3802   0   Sep 08 ?           0:07 /usr/apache2/bin/httpd -k start

        Don't be alarmed to find approximately 10 of the above processes.
        Also, do not be alarmed by this process;

        root  498   1   0  Jul 17 ?    1:28 /usr/apache/bin/httpd -f /etc/apache/httpd-standalone-ipp.conf

        It is simply the older apache 1.3 being used by the Internet Print Protocol (IPP) listener
        on network port 631.  Since it is not running on port 80, it will not conflict with your
        web server configuration here.


7.  Next, let's put something useful for testing in the apache2 web server's
    "DocumentRoot" directory.  Using your choice of text editor, create the
    following file (web page) and call it phpinfo.php

            <html>
            <body>
                  <p>Hello World</p>
                  <?php phpinfo(); ?>
            </body>
            </html>      

     Place that in your DocumentRoot directory as defined by the Apache httpd.conf file.
     If you aim your web browser at  http://your-host-name/phpinfo.php
     and all is working, then you should get detailed information about the
     configuration of PHP, Apahce, and MySQL.  Note that after testing, it is
     advised to either remove the above web page, or protect it with http authentication,
     as it reveals a large amount of information about your site that would be useful
     to an attacker.

     By now, you have noticed that the above phpinfo web page basically only really tests apache and PHP
     working together.  While the output will show you information about the MySQL client being enabled,
     it does not actually test connections to the MySQL server.   Almost 99% of the time, if you made it this
     far, you can simply install a PHP/MySQL application and expect things to work.   However, if you are
     one of those frustratingly hyper-analytical personality types that likes to dwell on completeness, accuracy,
     and testing almost everything, below is a simple PHP web page that will do the following;

          a.  Attempt to open a connection to MySQL from a php page.
          b.  Select the "mysql" database name, which is a db that exists after all MySQL installations.
          c.  Show the list of table names that exist inside the mysql database.

      Most of the code is taken from examples of function usage in the
PHP manual.
      Copy the PHP code below into a file (web page) and name it something like simple-test.php.
      Edit the file and insert the password for connecting to your mysql server.
      Place the file in your web server DocumentRoot (same place you put phpinfo.php earlier).
      Here is the php code;

        <?php
        $db_username = "root";   // EDIT if needed:  The username for mysql.
        $db_password = "insert-yours-here";  // EDIT ME: this is YOUR password used for mysql.
        $db_hostname = "localhost";
        $db_name = "mysql";  // name of a database that always exists after install of MySQL

        if (!mysql_connect($db_hostname, $db_username, $db_password)) {
            echo "Can't connect to MySQL Server";
            exit;
        }else{
            echo "Connection to Mysql server succeeded.";
            echo "<br>";
        }

        // Now query the db and get the list of tables.
        $result = mysql_db_query($db_name, "SHOW TABLES");

        if (!$result) {
           echo "DB Error, could not list tables\n";
           echo 'MySQL Error: ' . mysql_error();
           exit;
        }

        echo "<p>The selected database is name is mysql.</p>";
        echo "<p>Here is the list of tables</p>";
        while ($row = mysql_fetch_row($result)) {
           echo "Table: {$row[0]} <br>";
        }

        mysql_free_result($result);
        ?>

        If you have copied the above correctly, and your software is configured properly, you can point a web
        browser at  http://yourserver.com/simple-test.php  and you should see something like this;

        Connection to Mysql server succeeded.
        The selected database is name is mysql.

        Here is the list of tables

        Table: columns_priv
        Table: db
        Table: func
        Table: help_category
        Table: help_keyword
        Table: help_relation
        Table: help_topic
        Table: host
        Table: proc
        Table: procs_priv
        Table: tables_priv
        Table: time_zone
        Table: time_zone_leap_second
        Table: time_zone_name
        Table: time_zone_transition
        Table: time_zone_transition_type
        Table: user
      

8. PHP Security.  

   Now that you have things working, be warned that the default install
   of PHP, and the default options in config file php.ini, are only safe for development
   work, but not for a production server that is exposed on a network. 
   Here is a strongly worded caution:

       A.  Delete the phpinfo and simpletest php webpages created in step 7 above.
             (Or immediately lock them down by protecting the directory they are in with http authentication
               of some type.)

        B.  It is strongly advised that you review a tutorial on securing PHP, such as;

    
http://www.php.net/manual/en/security.php
     http://phpsec.org/projects/guide/
     http://www.sitepoint.com/article/php-security-blunders

   If you do not have time for that, at least take a look in your php source code directory
   at the suggested (more safe) configuration file php.ini-recommended.  You may wish to compare
   this with the basic starting config file php.ini-dist to see what changes are made for
   security and performance of a production site.  ( # diff  php.ini-dist  php.ini-recommended | less )

I hope this has answered a few questions and provided useful hints.
Enjoy your Solaris SAMP server.  Our next article will explore building this same set of
packages in 64-bit mode, using the Sun Studio 11 Compilers.

There are many documents and blogs that can be found on the internet
regarding how to use Solaris 10 for a SAMP Server (Solaris, Apache2, MySQL, PHP).
However, many of them are for older versions of the software packages mentioned
above, or do not include the popular PHP language.  Some of them lack any detail
or examples to help you understand what is going on.

Before starting, it should be clarified that an installation of Solaris 10 or Solaris
Express does include Apache 2.0.x and Mysql4.  The Companion CD for Solaris 10 also
includes PHP4.  However, at this time Solaris does not bundle PHP5 or MySQL5 at all.

An older article for configuring a SAMP server with the above packages
can be found at;
http://www.sun.com/bigadmin/content/submitted/samp.html
although it lacks any significant detail, and uses the older apache 1.3.  A much better
article by Mel Lester is found at;

http://www.sun.com/bigadmin/jsp/descFile.jsp?url=descAll/amps_apache_mysql_p
  (http://meljr.com/~meljr/AMPSolaris10.html)

which is well written, shows much detail, and is almost what we want, with
the exception that it uses the version of MySQL 4 that is bundled with Solaris 10,
and not the current MySQL version 5.x that we prefer.

The primary reason that many of us like to rebuild the software is to obtain recent
versions of the packages due to performance, bugs, or security fixes, and possibly to include
compile time options that provide features you may need for various PHP web applications.

For this exercise, the installation will use the following software;

  - Apache2 as delivered with the Solaris installation.
  - Mysql 5 from www.blastwave.org using pkg-get to install.
  - Latest PHP5 from php.net, downloaded and compiled.

and build it in 32-bit mode, using a mostly GNU tool chain.

The procedure below will integrate these three applications together so that you are ready to
use "Solaris 10, Apache2, PHP5, and MySQL5" web applications.

Here are the Steps:

1.  Install Solaris 10, Solaris Express/Nevada, or OpenSolaris.

2.  Make sure your system is networked so that it can reach the internet and is using a
    static IP Address.  If you need assistance with network configuration, review the
    following documentation;  http://docs.sun.com/app/docs/doc/816-4554

3.  We wish to install Mysql5 from Blastwave.org.  Open a web browser, go to this URL;
    http://www.blastwave.org/howto.html
    and perform steps 1 through 7.
    It's that simple, and you are now ready to use the pkg-get
    command to install packages such as mysql5 over the network.

4.  We are now ready to install mysql5 packages.
    From a console or xterm window, log in as root and issue these commands;
    # /opt/csw/bin/pkg-get -i mysql5 mysql5client mysql5devel mysql5rt
    # /opt/csw/bin/pkg-get -i mysql5test

    Note:  It is very important to install the mysql5devel package
    above, or else you will have trouble building PHP5 later, below.

5.  Now let's set up mysql5.  Follow this guide:
    http://www.blastwave.org/mantis/main_page.php
    [ I have repeated it here in case the page is down, and also expanded
      upon some of the discussion. ]

    A) Create the config file /opt/csw/mysql5/my.cnf:
       Copy one of the my-*.cnf files in /opt/csw/mysql5/share/mysql/
       to /opt/csw/mysql5/my.cnf and make any changes appropriate for your
       environment, such as enabling InnoDB.
       Note that /opt/csw/mysql5/var is a deprecated location for my.cnf
       If you are not sure of which file to copy, use my-small.cnf

    B) It is important to set up a mysql user and group BEFORE initializing the
       database in the next step.  This is done for you by the Blastwave package
       install script.  However, if you are building mysql from source, you will
       need to create a mysql user and group as follows:

       # groupadd mysql
       # useradd -c "MySQL Server" -d /dev/null -g mysql -s /bin/false mysql

    C) Initialize the mysql database and fix the permissions:
       cd /opt/csw/mysql5
       ./bin/mysql_install_db
       chown -R mysql:mysql ./var

       CAUTION:  If you skip the "chown" step above, MySQL will refuse to start.

    D) Start mysql5:
       To simply attempt to start the server and see if the above
       steps were done correctly, you can issue this command;

          #  cd /opt/csw/mysql5 ; /opt/csw/mysql5/bin/mysqld_safe &

       You can then check with the ps command to see if it started,
       and use the kill command and the PID to stop it.

       CAUTION:  Make sure you kill the above process before proceeding,
       or else MySQL will not start properly when you enable the SMF server below.
       This command should work;

         #  pkill mysql

       Now, to ensure it will start after a reboot, read on;

       NOTE:  Recent builds of Solaris Express, Nevada, and Solaris
       10 updates are using SMF to start daemons such as mysql.
       The process below may vary.  If your version of Solaris uses SMF,
       you will use the svcadm commands shown below to
start/stop Mysql5.

       Old RC file method:

           # /etc/init.d/cswmysql5 start

       New SMF method:

       If you installed the mysql5 package on a version of Solaris that is
       using SMF instead of RC files, you will find  that the package
       installed an SMF manifest for mysql5, and you can see the
       state of the service by using this command;

       # svcs -a | grep mysql
       disabled       13:36:01 svc:/network/cswmysql5:default

       To make sure the mysql5 server starts (and also at reboot),
       issue this command;
       # svcadm enable svc:/network/cswmysql5:default

       You can verify using this command again;
       # svcs -a | grep mysql
       online         15:12:43 svc:/network/cswmysql5:default

       You can stop the server with command;
         # svcadm disable svc:/network/cswmysql5:default
       and it will remain stopped, even across a reboot, until you
       issue the svcadm enable command.

    E) PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
       This should NOT be the same as your Solaris root user password!
       To do so, start the server, then issue the following commands:


       To set the local password;
           #  /opt/csw/mysql5/bin/mysqladmin -u root password 'new-password'

           #  /opt/csw/mysql5/bin/mysqladmin -u root -h zhost password 'new-password'
       ( The above command line will fail, and is not needed, if you have disabled
         network access via the security discussion in part "5i" below. )

       See the mysql5 manual for more instructions.
       http://www.mysql.org/doc/

    F) OPTIONAL:  Takes some time. You can run test suites for the MySQL
       daemon with the following commands;
       # cd /opt/csw/mysql5/mysql-test
       # ./mysql-test-run

    G) Check the install:
           #  ./bin/mysql -p
       -you willbe prompted to enter MySQL root's password-

       You should see a mysql prompt.
       Try a command such as STATUS to see if the server responds.
       Next, try to run a test query from the mysql prompt:
       show databases;
       -The mysql and test database is returned-
       quit

       Note:  Startup options may be overriden by creating and editing either 
              /opt/csw/mysql5/etc/mysql5rc

              or   /etc/opt/csw/mysql5rc. 
       The template for mysql5rc is in /opt/csw/mysql5/share/mysql. You

       must use this template, if making an rc file for your system.

       For example,

       a.)   #  mkdir -p /etc/opt/csw
           (I use these permissions - `chown root:bin /etc/opt/csw`
           and `chmod 0755 /etc/opt/csw`)

       b.)  #  cp  /opt/csw/mysql5/share/mysql/mysql5rc  /etc/opt/csw/

       If no mysql5rc file is available, the daemon starts with defaults.
       If this is your first experimental system, don't bother with this step, it is optional.


   H)  Reference Docs:

       http://www.mysql.org/doc/
       http://dev.mysql.com/tech-resources/articles/mysql_intro.html

   I)  MySQL Security:   An item that is beyond the scope of this article.  However,
       there are some very basic steps to be considered:

       *  Make sure the MySQL root user has a password set, and that it is different
          than the host system root password.

       *  Make sure that only the mysql user has read and write access to the database directory.

       *  If using mysql on a web server for PHP (so only localhost connections are needed
          between php/apache and mysql), add the line "skip-networking" to the [mysqld] section
          of your /opt/csw/mysql5/my.cnf configuration file.  This will disable all TCP/IP remote
          connections to the MySQL server daemon.

       *  Disable the use of the LOAD DATA LOCAL INFILE command, which could permit
          unauthorized reading from local files, especially when new SQL injection
          attacks occur.  In the [mysqld] section of your my.cnf file, add

            set-variable=local-infile=0

       *  Get rid of anonymous user accounts in the users table.

       The above steps only scratch the surface, but make a good level of improvement
       after installation.  Please do review articles about MySQL security on the web
       by entering "Securing MySQL" into your favorite internet search engine.


6.  We are now done with installing and testing MySQL5.  Next, let's build PHP5.
    Let's borrow portions from this web page, http://meljr.com/~meljr/PHPSolaris10.html
    with the kind permission granted by Mel, but modify some of the PHP configuration since
    we are using different options and paths.

    Specifically, we will change the configuration of PHP5 before compiling to use
    the path to our Blastwave MySQL5 in  /opt/csw/mysql5, and also add some other options.
    The procedure will also verify that you have the needed GNU tools installed to build PHP5.

    A.  Log into the global zone as root and ensure that /opt/csw/bin and /usr/sfw/bin are in $PATH
        global# echo $PATH
        /opt/csw/bin:/usr/sfw/bin:/usr/sbin:/usr/bin:/usr/openwin/bin:/usr/dt/bin:/usr/ccs/bin

        OK, let's talk.  First, you may not want to modify the .profile for root and also
        clutter up the / directory with junk.  I'd suggest, being Solaris 10, Solaris Express,
        or OpenSolaris, that you create the dir /root, and make another root account in
        /etc/password that uses the bash or ksh shell, and points to /root as a home dir.
        But that is a choice and topic for you and google.  Whatever you decide, please ensure
        that your path has the components above.  Then proceed.

    B.  Use the blastwave.org pkg-get command (installed in step #3 above) to install
         the gnu autoconf, automake and gsed packages.
         Versions of the below software should be relatively similar or more recent.

        global#  pkg-get -i autoconf
        ...
        global#  which autoconf && autoconf --version | head -2
        /opt/csw/bin/autoconf
        autoconf (GNU Autoconf) 2.59
        Written by David J. MacKenzie and Akim Demaille.

        global#  pkg-get -i automake
        ...
        global#  which automake && automake --version | head -2
        /opt/csw/bin/automake
        automake (GNU automake) 1.8.3
        Written by Tom Tromey <tromey@redhat.com>.

        global#  pkg-get -i gsed
        ...
        global#  which gsed && gsed --version | head -2
        /opt/csw/bin/gsed
        GNU sed version 4.1.4
        Copyright (C) 2003 Free Software Foundation, Inc.

    C.  Verify availability of other Open Source Software Required to install PHP.
        (You can review this if you wish:  http://www.php.net/manual/en/install.unix.solaris.php )
        Versions of the below software should be relatively similar or more recent.

        global#  which gcc && gcc --version | head -2
        /usr/sfw/bin/gcc
        gcc (GCC) 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
        Copyright (C) 2004 Free Software Foundation, Inc.

        global#  which gmake && gmake --version | head -2
        /usr/sfw/bin/gmake
        GNU Make 3.80
        Copyright (C) 2002  Free Software Foundation, Inc.

        global#  which flex && flex --version | head -2
        /usr/sfw/bin/flex
        flex version 2.5.4

        global#  which bison && bison --version | head -2
        /usr/sfw/bin/bison
        bison (GNU Bison) 1.875
        Written by Robert Corbett and Richard Stallman.

        global#  which gm4 && gm4 --version | head -2
        /opt/csw/bin/gm4
        GNU M4 1.4.3
        Written by Rene' Seindal.

        global#  which perl && perl -v | head -2
        /opt/csw/bin/perl

        This is perl, v5.8.7 built for sun4-solaris-thread-multi

        global#  which gunzip && gunzip -V | head -2
        /usr/bin/gunzip
        gunzip 1.3.3-patch.1
        (2002-03-08)

        global#  which gtar && gtar --version | head -2
        /usr/sfw/bin/gtar
        tar (GNU tar) 1.14
        Copyright (C) 2004 Free Software Foundation, Inc.


    D.  Test the Open Source tools by building libxml2 from source:
         Download the latest version from:  http://xmlsoft.org
         At this time, we found the following version of zipped source here;

            # wget ftp://xmlsoft.org/libxml2/libxml2-2.6.26.tar.gz

        You choose which directory to perform the following steps in;

         global#  gunzip -cd libxml2-2.6.26.tar.gz | gtar xvpf -
         global#  cd libxml2-2.6.26
         global#  ./configure
         ...
         global#  gmake
         ...
         global#  gmake install
         ...

         You are now done building and installing the libxml2 software and will
         find it located in /usr/local


    E.  If the file /etc/apache2/httpd.conf doesn't exist:

             global#   cp  /etc/apache2/httpd.conf-example  /etc/apache2/httpd.conf

        Edit /etc/apache2/httpd.conf with your favorite text editor;

        * Set ServerName if necessary (default is 127.0.0.1) to your hostname.
        * Set ServerAdmin to a valid email address.


    F.  Download and Compile the latest production version of PHP from www.php.net
        Again, you choose your own directory such as /src or /build or whatever.
        As of this writing, it was at  http://www.php.net/downloads.php#v5
        We choose to download the gzipped version so we could use the command below
        to proceed;

        global#  gunzip -cd  php-5.1.6.tar.gz | gtar xvpf -
        ...
        global#  cd  php-5.1.6

        This is where we differ from the original web page.  The original was using
        the older mysql4 found in /usr/sfw, and we are using a current mysql5 located
        in /opt/csw/mysql5.  So our choice of configuration options is now;

        global#  ./configure --with-apxs2=/usr/apache2/bin/apxs --enable-dbase \
        --with-libxml-dir=/usr/local --with-config-file-path=/etc/apache2 \
        --with-mysql=shared,/opt/csw/mysql5 \
        --with-mysqli=shared,/opt/csw/mysql5/bin/mysql_config \
        --with-xpm-dir=/usr  --with-gd  --with-tiff-dir=/usr  --with-bz2=/usr/lib \
        --with-jpeg-dir=/usr  --with-png-dir=/usr  --with-zlib  --enable-mbstring \
        --enable-calendar   --enable-bcmath  --enable-ftp  --enable-exif

        The above configuration options are good enough for a simple server setup.
        There are many other options, and that is left for user choice and documentation.
        You can see some of the options by entering command   # ./configure --help
        and also review  http://www.php.net/manual/en/configure.php
        NOTE:  If you try to enable openssl, you will have to recompile Apache2 and MySQL
        to have the same version openssl library, or else PHP to MySQL connections will fail.
        If you are going to use cookies for sessions, you might see a performance gain by adding
        the mcrypt library to your system, and using PHP compile option  --with-mycrpt.
        Amusing Note:   If you are curious what config options other people are using, simply
        try entering "phpinfo()" into your favorite internet search engine :-)
        Anyway, let's build it now;

        ...
        global#  gmake
        ...
        global#  gmake install

        ...
        Installing PHP SAPI module:       apache2handler
        /var/apache2/build/instdso.sh SH_LIBTOOL='/var/apache2/build/libtool' libphp5.la /usr/apache2/libexec
        /var/apache2/build/libtool --mode=install cp libphp5.la /usr/apache2/libexec/
        cp .libs/libphp5.so /usr/apache2/libexec/libphp5.so
        chmod +x /usr/apache2/libexec/libphp5.so
        cp .libs/libphp5.lai /usr/apache2/libexec/libphp5.la
        libtool: install: warning: remember to run `libtool --finish /build/php-5.1.2/libs'
        chmod 755 /usr/apache2/libexec/libphp5.so
        [activating module `php5' in /etc/apache2/httpd.conf]
        Installing PHP CLI binary:        /usr/local/bin/
        Installing PHP CLI man page:      /usr/local/man/man1/
        Installing build environment:     /usr/local/lib/php/build/
        Installing header files:          /usr/local/include/php/
        Installing helper programs:       /usr/local/bin/
          program: phpize
          program: php-config
        Installing man pages:             /usr/local/man/man1/
          page: phpize.1
          page: php-config.1
        Installing PEAR environment:      /usr/local/lib/php/
        [PEAR] Archive_Tar    - installed: 1.3.1
        [PEAR] Console_Getopt - installed: 1.2
        pear/PEAR can optionally use package "pear/XML_RPC" (version >= 1.4.0)
        [PEAR] PEAR           - installed: 1.4.6
        Wrote PEAR system config file at: /usr/local/etc/pear.conf
        You may want to add: /usr/local/lib/php to your php.ini include_path
        Installing PDO headers:          /usr/local/include/php/ext/pdo/
        #


    G.  Copy the file php.ini-dist from your php-5.1.6 source directory to Apache2's config dir;

        global#  cp  php.ini-dist   /etc/apache2/php.ini
       
        If you are setting up apache web servers in zones, perhaps you might have an
        example path such as;
             global#  cp  php.ini-dist  /zones/zone0/root/etc/apache2/php.ini
        or whatever zone you are using.


Next, we will edit configuration files.  Continued in the next blog entry...
  

Tuesday May 10, 2005

What did you expect? It is just getting started. Under construction.