Thursday Apr 07, 2011

PHP Plug-In for Oracle iPlanet Web Server 7

Finally, I found time to publish a PHP Plug-In for Oracle iPlanet Web Server 7. This plug-in is delivered on a personal effort to help customers try out PHP within Oracle iPlanet Web Server (formerly known as Sun Java System/ONE Web Server 7). You can download the binaries from here .

Currently, the bits are available for Linux (32/64-bit) and Solaris 10 SPARC (32/64-bit) only. If time permits, I will try to make one available for Windows as well. 

Note: Please note that these binaries are made available on a personal basis and is offered with no warranties (both implied and explicit) and my employer - Oracle or any of its affiliates - does not endorse my effort on this. 

I did not have enough time to test enough on these binaries and at beast can be considered for evaluation purposes and if you are deploying this on production then you are very much on your own !!!

Now that I have clarified your legal rights with downloading these binaries, let me just do a quick walk through on how to get PHP working within Oracle iPlanet Web Server 7 (hereforth simply referred as Web Server ). 

- Download latest version (as of April'2011) of Web Server from Oracle E-Delivery. For more information, about this latest release, check out Oracle iPlanet Web Server 7 Update 11 Release Notes

- Once Web Server 7 is successfully installed at say /opt/oracle/webserver7. 

- You will need to download the corresponding version of PHP Plug-In for Web Server 7 from here  (Please download the bits corresponding to your OS)

- Now, unpack this zip file under <Web Server 7 Installation Directory>/plugins directory 

- Finally, go to the unzipped location and run the following commands :

cd /opt/oracle/webserver7/plugins/php

./setupPHP -instancename=https-<hostname of your machine> (this should correspond to the https- directory that you will find within the Web Server 7 installation directory.) 

Now, you are ready to evaluate PHP within Web Server 7. You could proceed to create new PHP scripts or deploy PHP applications like WordPress or Joomla within Web Server 7. 

If you are satisfied with the PHP configuration, you will need to run the following command so that Web Server 7 administration server is aware of your changes.

sriramn@sriramn:~$ cd /opt/oracle/webserver7

sriramn@sriramn:~$ ./admin-server/bin/startserv

sriramn@sriramn:~$ ./bin/wadm pull-config --user=admin --config=HOSTNAME  HOSTNAME

Friday Mar 11, 2011

Tips & Tricks that I learned while using Git

As with any developer, who got into programming between 1995 - 2005, I have been using CVS and Subversion as my primary source code repository for most of the time - both as part of work and also to manage my personal development projects.  

However, couple of years back, during my involvement with open source projects like PHP as part of Web Stack development for Open Solaris and Linux, I got introduced to distribution version control management system like Mercurial. The concepts of distributed version control intrigued me and the benefits of such a system became immediately apparent. I guess, I fell in love with Mercurial almost instantly. However, in recent times, I am getting more inclined towards 'Git'  - yet another distributed source code management system - mainly because of its Swiss Army knife approach and also thanks to the popularity of sites like 'Github' - which allows developers to collaborate in a more simpler fashion. 

Ok, coming back to the topic of my today's blog - At work, our project still uses 'CVS' extensively - which typically hosts the main repository in a central system. This kind of centralized system can block your work if your team is geographically dispersed and you end up frequently waiting for your code to be reviewed and approved before you are allowed to commit your patch.  

After working with distributed system and enjoying its benefits like the one mentioned here , here and here, I decided to mirror our CVS based project within Git and here are some of the tips and tricks that I have learned while using Git. Hope this helps some one, who is trying to learn and use Git at work..

1. Installing Git

Git installation experience can vary depending on what OS you are using for your development.  I use RHEL4 (RedHat Enterprise Linux 4) for my development and I had to install the following rpm git-1.7.3.4-1.el4.rf , git-arch-1.7.3.4-1.el4.rf to install 'Git' on my system. I guess, a simple googling can provide you instructions on how to install Git on your system. 

2. Creating a repository. 

Creating a repository within 'Git' can be as simple as moving to the top level of your source code directory and running 'git init'. Some times, you might be pulling repository from your friend's workspace. In that case, you will need to run 

git clone <location of your friend's git workspace location>. This location can be accessible either through 'http://' or 'ssh://' 

3. Making changes and committing to the repository

Any time, you make changes within your source repository, you will need to explicitly tell 'Git' to add this change within its repository. For me, coming from CVS or Subversion (svn) back ground, this was a big adjustment. In Git, I typically run a command like 

git ls-files --modified -> This command lists out the list of files that you have modified.  

Now, to add these modified files, I run a command like below

git ls-files --modified | xargs git add  -> This command will add the modified files within Git repository. 

Also, Git allows you to show the status of what is going to be committed etc. You could get this information by running a command like: 

git status -s | less 

Alternatively, if you want to add all the files that has changed , you could run 'git add --all' . This option allows you to capture all the files without having to manually add these files to the 'Git staging' area as I mentioned earlier. 

4. Saving your workspace 

Git has a concept called 'staging' -> which allows you to stage all your changes and later decide if you want to commit this change within the repository.  For example, any time, you make a change to your source file and run 'git add <filename>' , git marks this change within 'staged' mode. At this point, if you are comfortable with committing this change, you could proceed to run 'git commit' or simply save these changes by running 'git stash <some-change-name>'. This allows you to save your changes without committing and also getting back to it at a later point of time. 

5. Managing Branches

As I mentioned earlier, Git allows you to maintain multiple branches within your workspace. For example, if I am working on 2 bugs at a same time, I could do some thing like

-> make change to foo.c

   -> git add foo.c

      -> git commit -m "initial changes"

   -> Now, I can fork 'foo.c' by creating a branch and working on a crazy change. To do this, I could do something like

-> git branch <crazy-changes>

-> Now, to checkout this branch, I typically do some thing like 'git checkout <crazy-changes>'. 

-> Now, I can make a real crazy change within 'foo.c' and commit this change within this branch by doing some thing like

git add foo.c

git commit -m "crazy changes."

-> Finally, I could switch back to the old/main branch, by doing some thing like

git checkout master

-> From this (the main) workspace, I have options to take a look at all the crazy things that I have done by doing some thing like

git diff master..crazy_changes

-> and apply this crazy changes within my current workspace by doing some thing like:

git merge crazy_changes

git ls-files --modified | xargs git add

git status -s  -> this tells me if I missed adding any files. If yes, I need to manually add those files.

-> Finally, I can commit this crazy changes within the main branch by doing some thing like

git commit -m "merging crazy changes within the main branch."

5. Bringing in changes from 'main' branch: 

-> Let us say, you are working on your 'crazy changes' branch and you know that your main branch has additional features that you want to bring within your 'crazy changes' branch. You will need to run the following command:

git rebase master -> This will cause Git to bring in changes from your 'master' branch and then apply your changes on top of it. 

 6. Collaborating with multiple programmers:

Frequently, I need to test my changes on various platforms (like Linux, Solaris, Windows etc.). In these cases, I typically try to replicate my workspace on these platforms by running a command like: 

git clone ssh://htaccess/home/sriramn/projects

Now, I can work on my repository in my remote machine and make changes there. When I am done with those changes, I can publish those changes by running the following command:

git pull origin/master -> bring in latest changes from the origin/master branch

git add <file> -> capture the changes made in my local repository.

git commit -m "changes in remote machine."

git push origin/master -> publish my local changes to the original repository. 

For any of the commands that I have mentioned here, you can also run 'git help <command-name>' to get more help.  

How Oracle Exalogic and Exadata Deliver Extreme Java and Database Performance

Webcast: How Oracle Exalogic and Exadata Deliver Extreme Java and Database Performance

Customer Registration URL: http://resources.cio.com/show/200001928/00203800023973CIOIDBDF0QB5O/

Date: March 15, 2011
Time: 1:00pm EST/ 10:00am PST

Oracle Exalogic Elastic Cloud is the industry's first engineered platform for enterprise Java application consolidation, and can be integrated with the Oracle Exadata Database Machine to create one high-speed computing
fabric to run middleware grids and database grids. Learn how this combination can deliver extreme Java and database performance, unmatched reliability and scalability, and cloud-enabled elasticity.

Wednesday Jun 23, 2010

Deploying PHP with FastCGI and OCI8 extension for iPlanet Web Server 7

Well, some one recently asked in our forums to how to get PHP working with Oracle iPlanet Web Server and Oracle Database. So, here is a quick write up on how I got this done:

First, let us download Oracle Instant Client package - Basic and Oracle Instant Client package - SDK Client for your respective platform from here . I am assuming here that I have downloaded and unzipped this file in my home directory.

    [sriramn@sriramn:~:$] unzip instantclient-basic-linux32-11.2.0.1.zip

    [sriramn@sriramn:~:$] unzip instantclient-sdk-linux32-11.2.0.1.zip

When I uncompressed this client library, I noticed that Oracle Client library is missing a symbolic link. Not sure, if this is a deliberate or a simple overlook from our Oracle Instant Client team. In any case, we will need create a missing symbolic link so that PHP is able to build with this Instant Client library.

    [sriramn@sriramn:~:$] cd instantclient_11_2

    [sriramn@sriramn:~/instantclient_11_2:$] ln -sf libclntsh.so.11.1 libclntsh.soNow, let us download PHP from php.net and try to compile with PHP/FastCGI support as shown below:

Now that we have got Oracle Instant Client downloaded and set up nicely let us go ahead and download PHP from here. Here, I am trying to download and use PHP 5.2. However, if you wanted to use PHP 5.3, you could do the same as well :

    [sriramn@sriramn:~:$] tar jxvfp php-5.2.13.tar.bz2

    [sriramn@sriramn:php-5.2.13:$] cd php-5.2.13

    [sriramn@sriramn:php-5.2.13:$] ./configure --prefix=~/php-52 --enable-fastcgi --enable-force-cgi-redirect --with-oci8=instantclient,~/instantclient_11_2 && gmake && gmake install

    Finally, to configure Oracle iPlanet Web Server 7 with PHP, you will need to download Oracle iPlanet Web Server 7 from hereand install . Please refer to this screencast, if you need help in installation. Once the installation is completed, let us run the following commands to successfully configure and run PHP scripts within Oracle iPlanet Web Server 7.

    [sriramn@sriramn:~:$] cd ~/sun/webserver7

    Ensure that Oracle iPlanet Web Server's Administration Server is running :

    [sriramn@sriramn:webserver7:$]./admin-server/bin/startserv

    Now, let us create a new configuration within Web Server 7. For more understanding on what is a configuration, please refer to our documentation in here.  

    You will need to provide the appropriate hostname of your machine for --server-name= argument

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-config --user=admin --http-port=80 --server-name=sriramn php

    Considering that I plan to only use to PHP within this configuration, I have disabled the bundled Web Container . It is up to you to decide what will be your requirements.  

    [sriramn@sriramn:webserver7:$] ./bin/wadm disable-java --user=admin --config=php

    Now, let us configure PHP as FastCGI . Here, you will need to change appropriately to reflect your PHP location. This setup is expecting your php.ini to reside under your PHP installation directory/lib/php directory. 

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-mime-type --user=admin --config=php-cgi --extensions=php,php4,php5 --vs=php-cgi magnus-internal/php

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-fastcgi-handler --user=admin --config=php-cgi --vs=php-cgi --mime-type=magnus-internal/php --role=responder --app-path="/home/sriramn/php-52/bin/php-cgi" --app-env="PHPRC=/home/sriramn/php-52/lib/php" --app-env="LD_LIBRARY_PATH=/home/sriramn/php-52/lib/php"

    # Finally, deploy this configuration to create an instance and followed by starting it. 

    [sriramn@sriramn:webserver7:$] ./bin/wadm create-instance --config=php sriramn

    [sriramn@sriramn:webserver7:$] ./bin/wadm start-instance --config=php sriramn

Now you will need to edit your PHP.ini to provide your Oracle Database connectivity information to connect to Oracle Database from PHP running as FastCGI within Oracle iPlanet Web Server.

Tuesday Jun 22, 2010

Avoiding duplicate cscope database error within VIM

One of my colleague came to me with this below error :

Error detected while processing /home/sriramn/.vim/plugin/cscope.vim:

line 45: E568: duplicate cscope database not added

Hit ENTER or type command to continue

earlier in the day. Since the solution is pretty straight forward and there does not seems to be a clear resolution on this within "google" , I thought would share the solution here just in case some one ran into this very similar issue ..

I am not a big fan of IDE's like Netbeans or Eclipse and would like to call myself a "Happy VIM camper". Though, I occasionally love writing PHP code in Netbeans .

Okay, coming back to this issue : This error pops up when VIM is already compiled with 'CSCOPE' module and you have also installed "cscopemenu.vim" plugin from here. To fix this issue, you will need to simply edit the file "~/.vim/plugin/cscopemenu.vim" and edit the line :

set cscopeverbose

to

set nocscopeverbose

You can also do the same by doing this by adding this line "set nocscopeverbose " to your ~/.vimrc file as well.

Saturday Jun 19, 2010

Sun Java System Web Server has yet another name..

Since I joined Sun Web Server engineering team, this product has gone through couple of name changes - mostly to be in sync with company's business directions. Here is a quick snapshot of the different forms that it took over the years..

Netscape Enterprise Server (3.6, 4.0, 4.1)

    -> iPlanet Enterprise Web Server (6.0) ->

       -> Sun ONE Web Server 6.1

         -> Sun Java System Web Server 6.1, 7.0

            -> Sun GlassFish Enterprise Web Server 7

Now, Oracle after its acquisition of Sun, has decided to complete the product naming circle one more time and call us now as "Oracle iPlanet Web Server". So, let us hope this name will stick a little longer than all its predecessors.

Thursday Jun 17, 2010

Sharing data with Fedora 12 as Guest within Mac

I recently tried out Fedora 12 as guest OS using Sun xVM Virtual Box on my Mac laptop. Af course, I had to assign 512 Mb Memory within my Virtual Box settings to get Fedora Installer program to kick off and complete the installation. This was pretty surprising to me. For long time, I have been amazed that Linux hummed along with just 256 Mb RAM. I guess, times have changed now. Otherwise installation went through amazingly fast .  I guess, this is one other area where OpenSolaris need to catch up with..

Now, I wanted Fedora to share my Documents and other useful folders from my Mac (to avoid keeping a duplicate copy of the same in 2 OS'es). So, I had to hack this to get where I wanted (thanks to googling...)

Within your host machine (whether Mac OS X or Windows), you will need to open Virtual Box settings for your guest image and then click on Shared Folders and   select to a share a location that you would like to share.


.




Now, you will need to boot up Fedora and will need to install source rpms of your kernel . It seems that to successfully install VirtualBox guest additions on Linux, Virtual Box tries to dynamically compile its kernel module for your system by looking for kernel source. So, you will need to install the kernel source .  Here is how you can do so...


a) From the top level Virtual Box menu, click on Devices and then click on Install Guest Additions. This will cause Virtual Box to mount Guest additions ISO image.

b) Now, open a command line terminal to install this new guest additions.

  • Now, you will need to install the latest Virtual Box guest additions package. To do so, you will need to select 'Install Guest Additions..' item from VirtualBox -> Devices menu item.
    • sriramn@fedora:-~$>  su (to become root)
    • /media/VBOXADDITIONS\*/VBoxLinuxAdditions-x86.run

d) Finally, you will need to run the following command within OpenSolaris guest to mount the location that you decided to share from your host (in my case, it is Mac OS's ~/Public ) directory.  I was able to do this as shown below




Also, if you would like this particular location to be mounted every time you boot your OpenSolaris guest, you could also add this below line to your /etc/



Now, if you need to copy any file from your OpenSolaris (guest) VM to your host machine , you could simply do something like

sriramn@opensoaris:~$ pfexec cp ~/Documents/foo  /Public/Drop\\ Box/

Hope you find this useful.


Thursday May 06, 2010

A Survey report on NOSQL Database for Cloud

During the last couple of months, myself and my colleague - Saneesh, besides our day job, started investigating on the current status of databases used by web applications that are deployed on the cloud. During this research, we stumbled onto some thing very interesting - a very interesting evolution known as NoSQL (Not Only SQL) - where in web applications and developers - can decide, based on the type of applications and its inherent data, as to how and where they want to store the data instead of always defaulting to one of the SQL based products. This is a huge revolutionary change for developers rather than having to simply use either MySQL or Oracle databases for their web applications. IMO, choice is always good.

Af course, as with any survey report - this involved a whole bunch of googling and even trying out some of these new stuffs. Found quite enlightening - to say the least. Thought of sharing this report with the rest of you. You can download the pdf version from here. Need to add that this report is no way complete and we are still gathering more and more data. So, please do not hesitate to correct us if you find anything incorrect or misleading.

During this research, we observed a whole lot of both positive and negative comments towards this evolution and we have captured most of these references towards the end of the report. Af course, all of these should also also available from the same googling that we did.

The most interesting conclusion - at least to me - is how much open source is vibrant and active around here and how it is helping in this new evolution.


Tuesday Feb 09, 2010

Check out latest development build of Web Stack

If you are using Cool Stack or Web Stack for your AMP (Apache, PHP and MySQL) stack needs on either Solaris 10 or Red Hat Enterprise Linux, then you might want to check out the latest development build update of Web Stack. This build delivers PHP 5.2.12 , Apache 2.2.14 etc. 

For more information on how to update to this build, please refer to my earlier blog on this topic. If you run into any issues, please use our forum for any trouble shooting tips.

Tuesday Feb 02, 2010

Web Server 7 Update 8 addresses critical Security Issues

Recently, Sun published Sun Alert for recently discovered security vulnerability within Sun Web Server and immediately released updates to Web Server 7 and Web Server 6.1 release train to address these discovered vulnerabilities. 

If you are running Sun Java System / iPlanet / Sun ONE Web Server, we strongly urge to upgrade to this latest update. 

Thursday Dec 17, 2009

Web Server 7 Update 7 is available now..

As a nice farewell for 2009, Web Server 7 engineering team announced the availability of Sun Web Server 7 Update 7 today. Web Server 7 Update 7 provides the following features / updates besides regular bug fixes.. For more information on this release, check out Release Notes . Here are some key features of this update:

  • Web Server 7.0 Update 7 introduces Kerberos/SPNEGO support.
  • Web Server 7.0 Update 7 supports Windows 2008 SP2 32 bit (x86) Enterprise Edition.
  • Web Server 7.0 Update 7 is integrated with NSS 3.12.5 which provides relief for the SSL/TLS renegotiation vulnerability (CVE-2009-3555) . Please refer to Jyri's blog on Web Server 7 and TLS vulnerability to learn more on this. 
  • Web Server 7 Update 7 now bundles Sun JDK 7 Update 17 on Solaris, Linux and Windows.

Monday Dec 07, 2009

Pet peeves on debugger..

On the topic of debuggers, here are some of my top most pet peeve when it comes to debuggers..

DBX

\* Hate pressing n every time to go to next line. For some reason, Sun Studio folks never provided a alias to 'Enter' key like the way we do have on GDB.

GDB

\* There is no nice way to display complex structures . For example, if you want to display a nested structure with some nested union / structure in it, good luck deciphering them. DBX's print does an excellent job on this .

\* Surprisingly for such a vibrant open source community, still there is no simple way to save your break points. If you need to save your breakpoints so that when you quit gdb and want to run again, you still need to do complex steps like

(gdb) info breakpoints

and  manually  copy the last column to some file or .gdbinit .

Come on, we are now living in Web 2.0 era where there is API's for every thing and at the least I would expect some thing like

(gdb) save-breakpoints.

Af course, one can write kludge macros to save your breakpoints etc.But, that is not elegant though... For some unknown reason, got into ranting mode. Ok, time to dump your head into your debugger..


GDB commands

Didn't realize that GDB had an option called 'commands' to execute extra commands after hitting a break point. That is pretty cool. For example, I can now do some thing like



(gdb) b <function name> if ($data)

(gdb) commands <breakpoint-number>
Type commands for when breakpoint 7 is hit, one per line.
End with a line saying just "end".

commands

silent

print $data

cont

end

 Af course, if you are using DBX on Solaris/OpenSolaris,you would do some thing like when { shell statements } .. Hope this helps some one..

Monday Oct 12, 2009

Interested in finding out what to do with DTrace inside PHP ?

I am proposing a talk in Zend Unconference'09 on the benefits of using DTrace within PHP. If you are attending ZendCon'09 or interested in hearing more on dynamic tracing within PHP, please vote for this talk by visiting here.  Thanks for your support. Here are some of my previous posts on this subject

 Hope to see you in ZendUnCon'09

Wednesday Sep 30, 2009

Web Stack 1.6 Development builds are available for testing

If you didn't know already, GlassFish Web Stack is an open source project within OpenSolaris and offers production support (also available as free download) for open source web tier components like Apache Web Server, PHPMySQL, Tomcat, Hudson etc on Solaris 10 Update 5 (or above) and on RedHat Enterprise Linux 5.2 (or above). Our latest release - Web Stack 1.5 is currently available for download and for more information on this product, kindly check out my earlier post.

Our next version Web Stack 1.6 is in active development and if you would like to follow up our development, you can do so as shown here. Web Stack 1.6 will include component version upgrade for components like PHP, Apache, MySQL, Ruby, Memcached.  With development build 1, PHP 5.2.11 Apache 2.2.13 have been integrated. 

Please note : This development builds are in active development and has not been through any testing. So, this development builds will most likely will have bugs and are meant only for testing purposes.

How to get Web Stack 1.6 Development build ?

GlassFish Web Stack 1.5 release is available either as

  • installation via native packages (SVR4 Packages for Solaris 10 and RPM for RHEL5.2). This is typically the preferred way in large enterprises. This installation will require root privileges and provides integration with Solaris 10 SMF etc.

  • installation via IPS (Image Packaging System) also known as 'Update Center'. This installation is typically preferred by developers and in enterprises where you have access to internet to download and install binaries from internet on your production machine !. This installation does not require 'root' privileges and all files (including web server document root and MySQL data directory) is configured under your installation directory. So, you might find it very intuitive to install, use , develop and even take it with you.

Currently, our development builds are available only through 'Update Center'. 

Installing Web Stack 1.6 (development builds) as IPS (Update Center)

IPS (Image Packaging System) is an open source technology built on Python and is the core underlying framework on how packages are delivered within OpenSolaris. This work was initially done for OpenSolaris.  Now, as with any open source projects, another open source project - Update Center has successfully ported this work for platforms like Solaris 10 and Linux.

Now, GlassFish Web Stack 1.5 release uses this Update Center open source project to deliver a minimal Python runtime and Update Center technology as part of initial download. Then you will need to fire up the Update tool GUI to download and install components that interests you.

Unlike OS native packages, Update Center technology does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

Here is a quick walk through on how to get your AMP stack up and running with this: 

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link
  • Now, you will need to unzip the downloaded tar ball and fire up the update tool GUI. You will need to download some thing like

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./bin/updatetool 

(Note: You will need GUI configured or DISPLAY set properly to successfully run the above command.)

(Note: If you do not have GUI/X11 configured on your Solaris / Linux machine, then you can do some thing like below to install

from command line.)

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -> to list all the component available


Now, firing up the GUI, will welcome you with a nice GUI like this below

Now, you will need to click on 'Edit Properties'  button and then 'Add Repository' and add the Repository URL to 'http://pkg.sun.com/layered/collection/dev'. 

    And then you will need to select this new repository as the default


Now, click 'Ok' and then select 'Available Add-ons'  to see all the new binaries that are available in this development repository. Now, you should be able to search Apache or PHP or MySQL and download the latest version. 

Note: Here, you will also find other Sun development binaries like GlassFish v3 etc.  



Wednesday Aug 26, 2009

Using DTrace to analyze your web site

During recent OSCON'09 conference, Jack Adams met with me to discuss on the ways to troubleshoot the problems with his web site. Check out this video.

A Jack Adams conversation with Sriram Natarajan, at OSCON 2009.

References: 

Saturday Aug 22, 2009

Sun Web Server: The Essential Guide

If you are one of those geeky folks using Sun Web Server (also known as Sun Java System Web Server , Sun ONE Web Server, iPlanet Web Server, Netscape Enterprise Server - Hmm... lot of incarnations) in your enterprise server with multiple cluster deployment or simply running a secure web server from your garage, you should be pleased to know that Amazon is now carrying this title  Sun Web Server: The Essential Guide . Ah, you know, what is more cool - Amazon Kindle carries this title as well. If you are one of those lucky few having a Kindle, you can get this instantly (ok, not that instant - probably in under 2 minutes) from here .

We love to hear what you think of this book. Please feel free to write to us at our Forum

Wednesday Aug 05, 2009

A simple way to get PHP working within Sun Web Server 7 on Solaris / RHEL

Some time back, I wrote this blog on how to leverage the PHP runtime integrated within OpenSolaris and use it to run PHP applications within Sun Java System Web Server 7. Well, if you are currently using Sun Web Server 7 on Solaris 10 or RedHat / CentOS Linux and wondering if there is a more simplified way to get PHP working within Sun Web Server 7, then my today's topic might be of more use to you.

Installing Sun Web Server

Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out some of these  performance benchmark blogs within our wiki. You can download and install the latest version of Sun Java System Web Server from here .

If you are adventurous, you can also build the open sourced version of this beast (available under BSD license) by following the instructions provided here

If you would like a little hand holding in installing our product, check out this nice demo . Hope, you are able to successfully install Sun Web Server 7 with the help of this demo. If not, you can always post your questions in our forums - where we developers will be happy to help you out !.

Installing Sun GlassFish Web Stack PHP

If you haven't yet heard of Sun Web Stack or more confusingly known as Sun GlassFish Web Stack - is an open source project within OpenSolaris - known as  Web Stack project - offers free download and production support (as part of Sun GlassFish Portfolio) for open source web tier components like Apache Web Server, PHPMySQL, Tomcat, Hudson etc on Solaris 10 Update 5 (or above) and RedHat Enterprise Linux 5.2 (or above).

Here is a quick way to get Web Stack PHP installed on your Solaris 10 or RHEL 5. If you prefer a little hand holding, please refer to my earlier blog on the different ways to install Sun Web Stack (along with some screenshots to guide you along the way).

Here is a quick walk through on how to get your PHP runtime installed

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link for your respective OS.
  • Now, you will need to unzip the downloaded tar ball and either fire up the update tool GUI for installing PHP runtime (as shown in this blog) or simply install it in the command line as shown below:

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg install sun-php52 sun-php52-apc

sriramn@sriramn:~/webstack1.5$ ./bin/setup-webstack

Note: If you are interested in other PHP optional packages like PHP MySQL connector or MySQL community package etc, you could get the list of packages available either from GUI or CLI. From CLI, you could do some thing like as shown below

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -a -> to list all the component available from our repository


Note:  Unlike OS native packages, IPS based installation (that you just did here) does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

How to get Web Stack PHP working within Sun Web Server 7 ?

Ok, Assuming you have successfully installed Web Server 7 and Sun Web Stack PHP on your system, here is a simple one liner configuration script that you can run to successfully configure Web Server 7 to execute PHP scripts .


sriramn@sriramn:~/webstack1.5$ ./php/5.2/samples/scripts/configure-sun-webserver --installroot=/home/sriramn/ws7 --instancename=https-<hostname>


Note: On Linux, because of a bug with the above script, please download this script and overwrite it over the default.

cp /tmp/configure-sun-webserver ~/webstack1.5/php/5.2/samples/scripts/

That is all there to it.

Now, you should be able to run php scripts under your web server's document root directory (which is typically <ws7-install-root>/https-<hostname>/docs/).

Note: In the above example, I have assumed that you will be installing both Web Server 7 and Web Stack PHP as the same user and you wanted to configure PHP runtime with the default instance (https-<hostname>) created by Web Server 7 installer. If in case, you would like to configure a separate instance for Web Server 7 then you could do the same either using Web Server 7 Administration CLI /GUI.  Here is a simple example of how to do so with CLI :



sriramn@sriramn:~/webserver7$ ./bin/wadm create-config --user=admin --http-port=80 --server-name=<ĥostname> php

sriramn@sriramn:~/webserver7$ ./bin/wadm disable-java --user=admin --config=php

sriramn@sriramn:~/webserver7$ ./bin/wadm create-instance --config=php <hostname.domainname>

sriramn@sriramn:~/webserver7$ ~/webstack1.5/php/5.2/samples/scripts/configure-sun-webserver --installroot=~/webserver7 --instancename=https-php

Thursday Jul 30, 2009

WebStack@OSCON

 Thought, I would share some of my OSCON'09 , where I spent some of the last week representing Sun at our booth besides attending some very interesting sessions. Our team presented a session as well -  Web Stack - Next Generation Open Web Infrastructure. We had a nice presence at our booths . We talked about OpenSolaris, GlassFish Web Stack and even gave away couple of iPod as well (as you can see here -   Tim Bray graciously selected the winner for one of our iPod winner and  Kai Seidler stopped by to select the winner for our second iPod.)

Well, couple of very interesting things that I observed during my presence at our Sun booth - where I did have a chance to meet lot of OSCON attendees :

  • most common question put to me was  - do you know what is going to happen to you after Oracle acquisition ? Well, I guess, after a while I had these coming out of my lips even without realizing -  "Currently the acquisition hasn't completed yet. So, Sun and Oracle still continues to operate as a separate company etc and honestly I have no clue whatsoever."
  • When I talked about OpenSolaris 2009.06Web Stack project , Sun GlassFish Web StackWeb Stack Enterprise Manager and our latest Web Stack 1.5 release - the most common question I got was "Why do you GlassFish in your product name ? Is Sun GlassFish Web Stack Enterprise Manager same as GlassFish Enterprise Manager?" . Well, this is one of the other answers that I had to repeat myself hundreds of times (if not more) "Sun is currently selling support for our project (where we hope to make money) as part of GlassFish portfolio and I guess, hence our product's name got prefixed with such popular open source project like GlassFish .
  • Interestingly, lot of folks showed lot of interest in our Web Stack 1.5 release on Linux. Even some of them were wondering if our stack can run on Ubuntu. Honestly, I was quite surprised.

Besides, we had different Birds of Feather sessions too (and had some very good attendance for some of these BoF sessions...)

Some time, it was quite tiring but probably was well worth it.

Installing AMP stack within GlassFish Web Stack 1.5...

Now that  Sun GlassFish Web Stack 1.5 release is done, let me walk you through the steps involved in setting up your AMP (Apache 2.2, MySQL 5.1 and PHP 5.2) stack working together. One of the other cool features of Sun GlassFish Web Stack 1.5 release , besides Web Stack Enterprise Manager, is its ability to support

  • installation via native packages (SVR4 Packages for Solaris 10 and RPM for RHEL5.2). This is typically the preferred way in large enterprises. This installation will require root privileges and provides integration with Solaris 10 SMF etc.
  • installation via IPS (Image Packaging System). This installation is typically preferred by developers and in enterprises where you have access to internet to download and install binaries from internet on your production machine !. This installation does not require 'root' privileges and all files (including web server document root and MySQL data directory) is configured under your installation directory. So, you might find it very intuitive to install, use , develop and even take it with you.

 Installing Web Stack 1.5 as a native package / rpm

  • Visit our Sun Web Stack 1.5 download page and 'click on Native components (does not include java component)' link to download our native packages. If you wonder, what is "java components" in this above link . Well, we refer "java components" as components like Tomcat, Hudson, GlassFish 2.1. Since, this blog is about setting up a PHP/MySQL based web site, you can reduce your carbon foot print by avoiding those extra bulky downloads..
  • unzip the downloaded tar ball and install by running the following command (you will need root privileges)

sriramn@sriramn:~$ sudo ./install amp

Now, if you are running on Solaris 10 and don't want to install on all local zones, then you could even do some thing like

sriramn@sriramn:~#  ./install -XG amp


For more information with related to this installation, please check out our Installation Guide. Once you have completed this installation, you might want to refer to our Getting Started Guide as to how to survive with our stack. This guide should help you with basic information like where to find our configuration files, how to start/stop servers etc.

Installing Web Stack 1.5 as IPS (Update Center)

IPS (Image Packaging System) is an open source technology built on Python and is the core underlying framework on how packages are delivered within OpenSolaris. This work was initially done for OpenSolaris.  Now, as with any open source projects, another open source project - Update Center has successfully ported this work for platforms like Solaris 10 and Linux.

Now, GlassFish Web Stack 1.5 release uses this Update Center open source project to deliver a minimal Python runtime and Update Center technology as part of initial download. Then you will need to fire up the Update tool GUI to download and install components that interests you.

Unlike OS native packages, Update Center technology does not verify or warn if you do not have installed any underlying dependent libraries that Web Stack 1.5 stack requires. So, we strongly recommend you to visit our System Package dependency link to ensure that you have these packages installed on your system.

Here is a quick walk through on how to get your AMP stack up and running with this: 

  • Visit our Sun Web Stack 1.5 download web page and download 'click on IPS based Packaging' link
  • Now, you will need to unzip the downloaded tar ball and fire up the update tool GUI. You will need to download some thing like

sriramn@sriramn:~$ unzip  webstack-image-1.5-b09-redhat-i586.zip

sriramn@sriramn:~$ cd webstack1.5

sriramn@sriramn:~/webstack1.5$ ./bin/updatetool 

(Note: You will need GUI configured or DISPLAY set properly to successfully run the above command.)

(Note: If you do not have GUI/X11 configured on your Solaris / Linux machine, then you can do some thing like below to install

from command line.)

sriramn@sriramn:~/webstack$ ./pkg/bin/pkg list  -> to list all the component available


Now, firing up the GUI, will welcome you with a nice GUI like this below

Now, you will need to click on 'Available Add-ons' to see all the Web Stack components listed (as shown below).

Note: If your company requires HTTP Proxy to be configured to access the internet, you will need to click on 'Preferences' windows and appropriately configure proxy information before proceeding any further.

Now, select Apache HTTP Server, PHP , PHP MySQL Connector, PHP APC and MySQL Community Server(5.1.30 version) components from this above list  and click on Install . You should see a confirmation window like below and if you see all the components that you need, click on 'Install' again. 

If you do not have GUI / X11 configured on your Solaris / Linux machine, then you could very well do some thing like below to install AMP stack from command line. 

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg list -a  -> to list all the component available

sriramn@sriramn:~/webstack1.5$ ./pkg/bin/pkg install sun-apache22 sun-php52 sun-php52-apc sun-mysql51 sun-php52-mysql -> to install and configure Apache, PHP and MySQL within your home directory.

sriramn@sriramn:~/webstack1.5$ ./bin/setup-webstack

At the end of this installation, you should have a fully configured Apache , PHP and MySQL runtime within your home directory/webstack1.5 directory.

You can now start the Apache and MySQL server by running the following command from your command line:

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-apache22 start -> by default Apache should now run at port 10080

  sriramn@sriramn:~/webstack1.5$ ./bin/sun-mysql51 start -> by default MySQL server should now run at port 13306


Now, you should be able to install applications like Joomla, Drupal, MediaWiki by simply unzipping these applications under Apache document root (~/webstack1.5/var/apache2/2.2/htdocs) directory

 For example, installing applications like Joomla / Drupal or MediaWiki should simply involve going to Apache document root and unzipping the application and following through the installation process within your browser (http://localhost:10080/joomla etc)

  sriramn@sriramn:~/webstack1.5$ cd var/apache2/2.2/htdocs

  sriramn@sriramn:~/webstack1.5/var/apache2/2.2/htdocs$tar zxvf ~/tmp/joomla\*.gz


Most of the open source components are designed to be built and installed on the same machine. So, building a stack and making it run on different machine takes a bit of work but getting the same stack to be installed at multiple locations takes lots and lots of work. Well, we are doing this release for the first time and would love to hear your feedback and this took us lots and lots of effort to get it right.

You will find all our start/stop scripts under ~/webstack1.5/bin/sun-\* (or wherever you installed /bin). Similarly, you will find all the configuration files under ~/webstack1.5/etc/\* (or wherever you installed /etc). 

Hope you like what you see . If you run into issues, we encourage you to write back to us at our Forum.

About

Sharing what little I know

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today