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

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.

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 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

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.

Wednesday Jul 29, 2009

GlassFish Web Stack 1.5 is available now ..

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). 

GlassFish Web Stack 1.5 , the latest update in this series, is available as of today and includes updated version components along with Enterprise Administration / Monitoring capability. Please refer to our Getting Started Guide for more information on how to get  your site quickly up and running using GlassFish Web Stack .

Some of the highlights of this release are :

You can try out GlassFish Web Stack 1.5 from here. GlassFish Web Stack 1.5 component runtime  is available as a free download for Solaris and Redhat Enterprise Linux and we hope you will choose Sun for your production support requirements.

Thursday Jul 16, 2009

Running PHP as CGI in OpenSolaris 2009.06

As part of Web Stack project, we deliver an integrated AMP stack within OpenSolaris where Apache 2.2.x, PHP 5.2.x and MySQL 5.1 is integrated together to work seamlessly. In this environment,
  • Apache is configured to run in pre-fork model
  • PHP is loaded as a module (mod_php5) within Apache (pre-fork) MPM.
  • Apache (worker) MPM model is not supported with PHP.

This particular scenario will work great for majority of users.

However, if you are one of those minority folks, who is interested in running PHP as CGI say with Apache 2.2 (worker) MPM, then here is what you need to do :

Configure Apache Server to start in worker (MPM) mode. This should provide you with better performance. This is how you can run Apache 2.2 in worker mode within OpenSolaris.

sriramn@opensolaris:~$ svcadm disable -s http:apache22

sriramn@opensolaris:~$ svccfg -s setprop http:apache22 httpd/server_type=worker

sriramn@opensolaris:~$ svcadm refresh http:apache22

sriramn@opensolaris:~$ svcadm enable -s http:apache22

Af course, to actually see any performance improvement, you will need to copy mpm.conf from samples directory(/etc/apache2/2.2/samples-conf.d/mpm.conf) to  /etc/apache2/2.2/conf.d/mpm.conf  and then tune this file accordingly.

Now that we have got Apache 2.2 worker MPM configured, if you try to run any PHP script within your document root directory, you will notice that they don't work. This is because, PHP module is not loaded if Apache is configured to run in worker MPM. (Remember, PHP modules and different extensions are not completely thread safe.) .

Now to get PHP scripts working again, here is what I did :

Copy PHP CGI script to the Apache's cgi-bin directory

sriramn@opensolaris:~$ pfexec cp /usr/php/bin/php-cgi  /var/apache2/2.2/cgi-bin/

sriramn@opensolaris:~$ pfexec chown webservd:webservd /var/apache2/2.2/cgi-bin/php-cgi

Now, you might want to create a file under /etc/apache2/2.2/conf.d/php-cgi.conf with the below content

#Create a alias for every location where you want to keep your PHP script.
ScriptAlias /contents/ "/var/www/contents/"
ScriptAlias /drupal/  "/var/www/drupal/"
AddHandler  php-cgi  .php
Action          php-cgi  /cgi-bin/php-cgi
<Directory /var/www/contents/>    
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>
<Directory /var/www/drupal/>
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
</Directory>

(updated above content to reflect the feedback received from Jeff's comments to my earlier blog. Thanks a lot, Jeff.)

Here's a better example:

# Create the Alias for every php application that you want to deploy

Alias /phpapp /var/www/contents/

Alias /drupal /var/www/drupal/

ScriptAlias /php-cgi /usr/php/5.2/bin/php-cgi

<⁞Directory /usr/php/5.2/bin/>
 Order allow,deny
 Allow from all
</Directory>

<Location "/phpapp">
 Order allow,deny
 Allow from all
 AddHandler php-cgi .php
 Action php-cgi /php-cgi
</Location>

<Location "/drupal">
 Order allow,deny
 Allow from all
 AddHandler php-cgi .php
 Action php-cgi /php-cgi
</Location>

Finally, you will need to restart the server to allow this above configuration to be loaded. Now, server should be ready to process any php files as 'cgi' script under /var/www/contents directory

Hope you find this useful.

Wednesday Apr 08, 2009

How to check your APC / Memcache performance statistics ...

PHP runtime within OpenSolaris includes performance booster extensions like APC (PHP extension to cache the compiled PHP script) and Memcache (PHP extension to integrate with Memcached server) to deliver the best performance, out of the box,  for production environment. Now, with upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 111 or above), we have also have made it easy to check out the performance statistics of these extensions which should further help you in getting the maximum juice from your system.

Installing OpenSolaris 2009.06 (preview build)

If you haven't tried OpenSolaris distribution yet, you can pick up the latest OpenSolaris 2009.06 (preview build) ISO image from here. and steps to install AMP (Apache, PHP and MySQL) stack within OpenSolaris is covered in my earlier blog .

Assuming, you have got a working AMP stack on your system and an application like Joomla, Drupal, or MediaWiki working fine , then here is what you need to do to display the performance statistics of these extensions to your browser :


For displaying PHP APC statistics to the browser:

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-apc-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> pfexec cp /etc/apache2/2.2/samples-conf.d/php-memcache-stats.conf /etc/apache2/2.2/conf.d/

sriramn@sriramn:~> svcadm restart http:apache22


Now, you should be able to access these statistics of APC and Memcache extensions by going to the http://localhost/stats/apc/ or http://localhost/stats/memcache/  respectively.

Tuning PHP APC

Once configured, APC statistics page , for example, would show this below page. 

This page should provide you with information as to how many PHP pages are cached and if the cache is getting missed etc. If you see frequent APC cache misses etc then you will need to appropriately increase APC shared memory size. You could do this and other APC configuration tuning by visiting PHP APC configuration page .

If you run into any issues, you could always write to us visiting at this link or by visiting our forum.


Sunday Apr 05, 2009

New DTrace probes within PHP in OpenSolaris 2009.06

Wez Furlong wrote a PECL extension to provide a DTrace probe within PHP more than 4 years back. As part of Web Stack project within OpenSolaris, this extension has been made available within Solaris 10 as well as in OpenSolaris distribution in the last year or so. 

Now, with the upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. See my earlier blog on this topic. Besides PHP version update, David Soria Parra - contributor within open source projects like Mercurial, PHP Web Stack has made  this (experimental) patch available to provide the following additional DTrace probes within PHP for this release :

\* compile-file-entry / compile-file-return -> This proble wil fire whenever Zend engine need to compile a given PHP script and can provide information as to which PHP script is currently going through PHP compilation process along with start and end line number. Note: PHP engine within OpenSolaris includes APC PECL extension - which caches the compiled PHP script when requested again and hence this probe will not fire in that circumstance.

\* function-entry / function-return -> This probe will fire whenever Zend engine is executing a PHP function and can provide information as to which PHP function along with its file name and line number is currently being executed by PHP Zend engine.

\* execute-entry / execute-return -> This probe will fire while executing PHP script and can provide information as to which file, line number is currently being executed by PHP Zend engine.

\* exception-thrown / exception-catched -> This probe gets fired whenever PHP runtime encounters an exception and can the classname when an exception is thrown.

\* error -> This probe gets fired whenever PHP runtime throws an error and can provide information like the error message, file name in which the error happened and the corresponding line number.

\* request-startup / request-shutdown  -> This probe gets fired at the start and end of processing a given PHP script and can provide the filename of the script , request URI . This should allow a given DTrace script to track the start and end of PHP script. 

Note:  this patch is under active development and will be further refined to add additional DTrace probes as well as to address any user reported issues. 

Considering that DTrace support is available for Mac as well as FreeBSD, I am sure, PHP community will be interested into looking into this patch as well.

Okay, so now, if you are interested in trying out OpenSolaris 2009.06 (preview build) and the updated AMP stack, check out my earlier  blog for detailed steps on this.

Here is a sample DTrace script that you can use as a reference point.

Friday Mar 27, 2009

Configuring Sun Web Server 7 with PHP runtime in OpenSolaris

With upcoming release of OpenSolaris 2009.06 (more specifically with Indiana build 110 or above), PHP runtime has been updated to the latest 5.2.9 release. Also, we have integrated a configuration script to simplify the steps required to configure PHP runtime with Sun Java System Web Server 7 (formerly known as Sun ONE/iPlanet Enterprise Server). Thought, I would you walk through the steps involved here

Installing PHP 5.2.9 in OpenSolaris 2009.06 (preview build)

Check out my earlier blog on how to get PHP 5.2.9 runtime within OpenSolaris 2009.06 on your system.

Installing Sun Web Server 7

Now, if you are new to Sun Web Server 7 and wonder why you need this beast, please do check out our performance benchmarks. 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 !.

Note1: You will need to install Java development environment within your OpenSolaris before proceeding to install Sun Web Server 7 on OpenSolaris . You could do this by running the following command from the command line window

sriramn@sriramn:~> pfexec pkg install java-dev

Note2:  You will need to perform Web Server installation as 'root' (or use pfexec ./setup)  and choose Web Server runtime user as 'webservd'. Please check out this  blog   for more information on installing Web Server 7 on OpenSolaris.

Finally, let us hook up PHP runtime within Sun Web Server 7. To do this, run the following script (which is newly available from OpenSolaris 2009.06 preview build 110 or above)

sriramn@sriramn:~> pfexec /usr/php/5.2/samples/scripts/configure-sun-webserver --installroot=/sun/webserver7 --instancename=https-sriramn

  \* where /sun/webserver7 is the location of the Web Server 7 top level installation location. Provide the appropriate location as in your case.

  \* and https-sriramn -> is the instance created under this installation. The instance name is typically the name of your hostname. You need to provide the appropriate value here.

Now, you will need to restart the Web Server 7 instance by running these below commands so that the newly modified changes can be loaded.

sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/stopserv
sriramn@sriramn:~> /sun/webserver7/https-sriramn/bin/startserv

Sun Web Server 7 is now ready to serve any PHP pages within its document root. For example, to deploy Joomla or Drupal, all you need to do is unpack these application tar balls under  /sun/webserver7/https-sriramn/docs/ and point your browser to http://localhost/joomla etc.

Now, you could write few PHP script within Web Server document root directory (<install-root>/<instance-name>/docs) and test our your configurations. If you are satisfied then we now need to move to the final step.  Web Server 7 Administration server need to be told of what we just did. This is accomplished easily by running these following CLI commands

sriramn@sriramn:~> pfexec chown webservd:webservd /sun/webserver7/https-\*/config/\*obj.conf

sriramn@sriramn:~> /sun/webserver7/bin/wadm pull-config --user=admin --config=sriramn sriramn.sun.com

where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Note: Web Server 7 integrates a Java web container within its default server instance. Having an integrated web container will  allow you to deploy Java Web Applications like JSP, Servlet etc. Hence, Sun Web Server has to load Java runtime as part of server startup - eating your previous CPU and memory resource. Now, if you plan on using only PHP runtme, you can easily disable Java Web Container by running he following commands :

sriramn@sriramn:~> /sun/webserver7/bin/wadm disable-java --user=admin --config=sriramn sriramn.sun.com

sriramn@sriramn:~> /sun/webserver7/bin/wadm deploy-config --user=admin  sriramn.sun.com

again where --config=<sriramn> will typically be the hostname of your machine or whatever configuration name that you chose

and

sriramn.sun.com is the fully qualified hostname (hostname.domainname) of your machine. Provide your corresponding hostname here.

Hope you will like our simplified integration and let us know with your feedback at our forum.

Monday Feb 09, 2009

Using PEAR/PECL extensions within OpenSolaris

I ran into couple of questions by OpenSolaris users (unfortunately posted at various different places) wondering as to how to use PHP extensions either PEAR or PECL based extensions within OpenSolaris. In OpenSolaris, say to download and install - say any PECL extension, one would do some thing like

 

sriramn@sriramn:$ pfexec /usr/php/bin/pecl install <extension name>

The downloaded and installed extensions will be available at /var/php/5.2/modules location. 

Note: If any PECL extension depends on any third party library to be available on the system, please make sure that those libraries first exist on OpenSolaris by searching OpenSolaris pkg database

Similarly, if you would like to the most popular XML Parser PEAR extension within your application, you could simply run the following command..

sriramn@sriramn:$ pfexec /usr/php/bin/pear install XML_Parser

Monday Jan 12, 2009

What's new with AMP stack in OpenSolaris 2008.11

If you are new to OpenSolaris, please check out this blog on how to get the AMP stack for this platform. 

Since the initial release of OpenSolaris 2008.05 - in the last 4-5 months -  our Web Stack project team has been busy revving up AMP (Apache, MySQL and PHP) stack specific bugs for OpenSolaris 2008.11 as well as porting this stack on Solaris 10 and RedHat Enterprise Linux 5 platforms as part of Sun Web Stack 1.4 release. For more information on this Sun Web Stack 1.4 release, check out this blog from my colleague - Jyri Virkki.

Now, in this blog, I thought I will write some of the important technical issues that has been addressed within AMP stack  for OpenSolaris 2008.11 release.

  1. General version update of AMP components like Apache = 2.2.9, PHP = 5.2.6 and MySQL = 5.0.67.
  2. Apache and PHP configuration files have been updated to provide better performance out of the box.
  3. Apache 2.2.9 now includes additional modules like Perl, FastCGI, DTrace etc
  4. Apache now provides various sample configurations like SSL configuration within /etc/apache2/2.2/samples-conf.d directory. 
  5. MySQL 5.0 server (64-bit) is also now available . However, MySQL server defaults to 32-bit by default. If you would like to run MySQL server as 64-bit, please refer to Administering MySQL server documentation within our wiki.
  6. Experimental MySQL 5.1 server is now available within webstack repository. However, to use MySQL 5.1 within OpenSolaris 2008.11, you will need to explicitly point to Web Stack repository to download and install this server. I guess, more on this in a separate blog !
  7. PHP file layout has been modified to be more in synchronization with the rest of the components. New PHP 5.2.6 file layout within OpenSolaris 2008.11 is /usr/php/5.2 - for all standard binaries, /etc/php/5.2 - for all configuration and /var/php/5.2 - for all data, pecl / pear modules and session specific contents. Also, at the time of startup , PHP engine will look and load all the INI files found under /etc/php/5.2/conf.d directory.
  8. PHP extensions like APC, DTrace is now enabled by default. Also, PECL extensions like XDebug, Memcache, Suhosin, idn and tcpwrap is bundled within OpenSolaris 2008.11. However, they are disabled by default. These extensions are bundled as individual ini files within /etc/php/5.2/conf.d directory.
  9. Individual PHP extensions can be either enabled or disabled by editing their corresponding ini files within /etc/php/5.2/conf.d directory and then restarting Apache SMF service. For more information on restarting Apache SMF service, please visit our Administering Apache Server documentation within our Web Stack Wiki.
  10. PHP extension now includes PEAR / PECL support as well. So, now it should be easy for developers to now download and install their favorite extensions. So, if you wonder as to how to use PEAR or PECL within OpenSolaris, you could do some thing like below
    1. /usr/php/bin/pear install XML_Parser
    2. /usr/php/bin/pecl install inclued

Now, if you install these PECL extensions as shown above, please remember to enable them by editing the php.ini found within /etc/php/5.2/php.ini  location.

You can load any of these PECL php extensions by editing php.ini and adding the following line at the end of the file

extension = [extension name].so

Note: Please note that unlike Linux or other platforms, Solaris engineering folks would like to avoid writing any user data (like data not provided by OS) within /usr location. So, we don't write any dynamic data into /usr. So, what this means is - PEAR or PECL will now install modules under /var/php/5.2/modules directory. However, PHP engine has been patched to look for modules both under /usr/php/5.2/modules as well as /var/php/5.2/modules directory

Hopefully, this acts as a good starting point on what to expect with AMP stack in OpenSolaris 2008.11. For more comprehensive information, please visit our Getting Started Guide or please visit your feedback within our OpenSolaris Web Stack forum .

Setting up AMP Stack within OpenSolaris

With the first release of OpenSolaris - OpenSolaris 2008.05 -  I wrote this and this and this blog on how to use AMP stack for this platform. Well, these blogs very much holds true for the latest release of OpenSolaris - OpenSolaris 2008.11 .

However, OpenSolaris 2008.11 includes a nice GUI application known as Package Manager  is available which further simplifies the process of downloading and configuring software applications that are available within its software repository.  

Let us use this application in this blog to see how easy it is to get an AMP (Apache, PHP and MySQL) stack going on your OpenSolaris 2008.11.

Assuming you have successfully installed opensolaris , let us start Package Manager as shown here

Now, you will need to choose whether you need either 

  • amp -  only the Apache 2.2.8 2.2.9, PHP 5.2.6 and MySQL 5.0.65 5.0.67 runtime
  • amp-dev  -  complete development environment and its tools like cvs, subversion, netbeans along with amp runtime

 and any other software packages that you are interested and click on Install / Update. 

Before Package Manager actually installs the packages on your system, you will get another chance to review your selection like below.

Now, click on Next should start the installation process. That should all be required to complete the installation of AMP runtime stack for OpenSolaris.  

Finally, if you are a GUI person and would prefer a GUI way to start/stop Apache and MySQL services as well as to edit your Apache configuration files then you might want to initialize the Web Stack environment as shown below

 and will need to enter your 'root' password for the initialization to complete. 

Now, if you are a command line person - like myself, you can manage your Apache and MySQL SMF service as below

  • For starting Apache and MySQL service, open a command line window and run the following command

    pfexec /usr/sbin/svcadm enable http:apache22

    pfexec /usr/sbin/svcadm enable mysql:version_50

  • Similarly, for stopping these services, run the following command:

    pfexec /usr/sbin/svcadm disable http:apache22

    pfexec /usr/sbin/svcadm disable mysql:version_50

If in case, you wonder what is SMF - you might wanna check out Service Management Facility project page for more information on how this is useful to you.  

Finally, if you run into any issues, you can check out our  Getting Started Guide or our Web Stack wiki or  feel free to post your issues at our  Web Stack forum page. 


Tuesday Sep 02, 2008

OpenSolaris Web Stack images are now available on Amazon EC2

If you want to quickly host a website running on Joomla or Drupal - or even a wiki based on MediaWiki  - on enterprise quality OS like OpenSolaris- that too without any initial overhead investment (sounds too good to be true ?) - check out our recently uploaded 32-bit OpenSolaris 2008.05 based images for Amazon Elastic Cloud Computing (EC2) environment. Some time back , I mentioned here on the different ways to try out OpenSolaris . Now, these AMI's  allows you to try out cool features within OpenSolaris like ZFS, DTrace, IPS even without a Live CD...

If you are already an Amazon EC2 customer or familiar with Amazon's cloud offering - you can skip these introductions and head out to the list of OpenSolaris based Amazon machine images(AMI).Read on for a quick intro on Amazon EC2 and how to get started..

How to get started with Amazon EC2:

  • Visit Amazon Elastic Compute Cloud (EC2) web site for information on pricing as well as to open Amazon Web Services account and to sign up for Amazon EC2 web service.
  • Check out Amazon EC2 Getting Started Guide for detailed setup instructions. You might also want to check out 'Introduction and FAQ' forum posting on Amazon Web Services developer forums
  • Now, you will need to register with Sun to get access to 32-bit OpenSolaris images by filling this form.
  • Finally, you can use Amazon EC2 tools as described within Getting Started Guide to launch these 32-bit OpenSolaris AMI's.

 


 


Sunday Jun 29, 2008

Check out this PHP programming book..

I was looking around for a good web site to refresh my PHP skills and I ran into this nice Practical PHP programming book . Found to be quite useful especially for some one who already is familiar with other programming languages. If you happen to know any other good PHP programming book - for experienced programmers , I would appreciate if you can share it with me..

Thursday May 22, 2008

Setting up phpMyAdmin in OpenSolaris

Recently, some one posted a question in a mailing list as to how to get phpMyAdmin working within OpenSolaris. So, here is a quick write up on how to get this done. Hope, you find this useful

Install and configure AMP stack within OpenSolaris

  • Install  OpenSolaris from LiveCD. You can download your copy from here
  • Install Web Stack components from OpenSolaris repository by doing something like
    • Open a command line terminal window and enter the below command . This will download components like Apache 2.2, MySQL 5.0 and PHP 5.2 from the repository.
      • pfexec pkg install amp
  • Let us register these downloaded packages with Solaris Service Management Framework (SMF) by doing something like
    • (from a command line terminal window)
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/network/http-apache22.xml
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/application/database/mysql.xml
      • pfexec /usr/sbin/svccfg -s /var/svc/manifest/application/database/memcached.xml
  • Finally, let us start Apache and MySQL services by doing something like
    • (from a command line terminal window)
      • pfexec /usr/sbin/svcadm enable http:apache22
      • pfexec /usr/sbin/svcadm enable mysql:version_50

 With this, you should have successfully configured an AMP stack for OpenSolaris. If you would like to try out some sample php pages, you could very well write these php pages under default apache document root directory ( /var/apache2/2.2/htdocs )

Note that within OpenSolaris the Apache document root directory - location in your hard disk where apache web server looks to serve incoming requests from your browser - needs special privilege to write to. Now, within OpenSolaris, you can get this privilege by prefixing with 'pfexec' command ahead.

For example, if I had to write a sample hello world php within OpenSolaris, I would do something like

pfexec vi /var/apache2/2.2/htdocs/hello.php

and save the following contents. Now, you should be able to access this page from http://localhost/hello.php

  <?php

   echo "Hello World";

  #Now, let us get the php server information

  echo phpinfo();

   ?>

Configuring phpMyAdmin within OpenSolaris 

Now, let us go ahead and download phpMyAdmin from here and unpack the downloaded tar ball to say /var/www. Again, from a command line terminal window, this is easily done - as shown below :

  •  Download phpMyAdmin to a local directory which is not accessible by every one to say /var/www
    • pfexec wget  phpmyadmin-2.11.6
    • pfexec mkdir -p /var/www
    • cd /var/www & pfexec gtar jxvfp ~/phpmyadmin-2.11\*
    • pfexec mv /var/www/phpmyadmin-2.11\* /var/www/phpmyadmin
  • Now, you might want to download this phpmyadmin.conf to Apache 2.2 configuration location and restart Apache Web Server. This configuration snippet instructs apache to to load phpMyAdmin from /var/www
    • wget phpmyadmin.conf
    • pfexec cp phpmyadmin.conf /etc/apache2/2.2/conf.d
    • pfexec /usr/sbin/svcadm restart http:apache22
  • Finally, you should be able to access phpMyAdmin from your browser by doing something like
    • http://localhost/myadmin


 

Friday May 09, 2008

Web Stack - Apache, MySQL, PHP and Ruby - Getting Started Guide on Open Solaris

If you had recently tried out OpenSolaris 2008.05 and are wondering, where to find Apache, MySQL or PHP components within this installation, please check out our Getting Started Guide . Originally, this guide is supposed to live under here - but for some reason it didn't happen. Hopefully, learn link within OpenSolaris will be updated soon to reflect this

Monday May 05, 2008

Famous 5 minute installation of Wordpress with OpenSolaris 2008.05

So, if I had to setup a blogging web site, where would I go other than the favorite - WordPress. I followed their famous 5 minute installation steps within OpenSolaris 2008.05 and here we go.

\* OpenSolaris 2008.05 is a LiveCD based distribution . So, if you need a AMP stack, you can get this on demand by  running the following command

[sriramn@sriram-laptop]: pfexec pkg install amp

 

\* Now, you can initialize and configure Apache and MySQL service by doing  something like

[sriramn@sriram-laptop]: pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml

[sriramn@sriram-laptop]: pfexec /usr/sbin/svccfg import /var/svc/manifest/network/http-apache22.xml 

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm enable network/http:apache22

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm enable database/mysql:version_50

 

\* Now, let us configure a Wordpress database within MySQL database. So, let us do something like

[sriramn@sriram-laptop]: pfexec /usr/mysql/bin/mysql -u root
 

here is a sample output that you would expect to see...

 

[sriramn@sriram-laptop]: pfexec /usr/mysql/bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \\g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

Type 'help;' or '\\h' for help. Type '\\c' to clear the buffer.

mysql>

Now , let us create a new database and assign a user to this.


  mysql> create database wordpress;

  mysql> grant all privileges on wordpress.\* to wp@localhost identified by 'wp';

  mysql> flush privileges;

  mysql> quit;

 

 

\* At this point, we have created a new database 'wordpress' with a user 'wp' and with password  'wp' assigned to manage this database. Well, not a whole lot secure but a good starting point though.

 

\* Now, you can download WordPress 2.5.1 from here unpack it to /var/apache2/2.2/htdocs - default apache document root directory.

\* Now, copy /var/apache2/2.2/htdocs/wordpress/wp-config-sample.php to /var/apache2/2.2/htdocs/wodpresswp-config.php and edit the first four lines of the file to reflect the just now configured database name , user name and password.

[sriramn@sriram-laptop]: cd /tmp

[sriramn@sriram-laptop]: wget http://wordpress.org/latest.zip 

[sriramn@sriram-laptop]: cd /var/apache2/2.2/htdocs/w 

[sriramn@sriram-laptop]: pfexec  unzip /tmp/wordpress-2.5.1.zip

[sriramn@sriram-laptop]: pfexec cp wordpress/wp-config-sample.php wordpress/wp-config.php

pfexec vi wordpress/wp-config.php and edit this file - first four lines and provide your database name, user name and password . In my case, wordpress/wp-config.php file looks something like 

 
<?php
// \*\* MySQL settings \*\* //
define('DB_NAME', 'wordpress');    // The name of the database
define('DB_USER', 'wp');     // Your MySQL username
define('DB_PASSWORD', 'wp'); // ...and password
define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
 

\* That's it . you are now ready to host your blog site . You should be able to reach your blog site by accessing http://localhost/wordpress

Simple, huh . Ah , one last thing - If you would like to take this site into production, you might want to enable to APC cache - which is integrated within OpenSolaris Web(AMP) Stack but not enabled as default. You could do this by editing /etc/php5/5.2.4/conf.d/apc.ini and for more APC related settings , please refer here. 

 

Note: Once you enable APC, please remember to  restart Apache service for this change to take into effect

[sriramn@sriram-laptop]: pfexec /usr/sbin/svcadm restart network/http:apache22


Hope, you find this useful. Feel free to ping me back if you have any suggestions or issues. Alternatively, you could visit OpenSolaris forum

Getting Ruby or AMP (Apache, MySQL and PHP) on OpenSolaris 2008.05

Today, Sun officially released a distribution - OpenSolaris 2008.05 based on a 3 year long open source effort happening with Solaris at  Open Solaris web site. You can catch more on this release from here.

Now, if you are web developer interested in figuring out how it is useful to you, here is what you might like

\* Ruby binaries can be downloaded and installed with the single command

   Open a command line terminal window and run the following command

    pfexec pkg install ruby

   Now, you can Ruby specific components by doing some thing like

    pfexec /usr/ruby/1.8/bin/gem install <component name>
 

\* MySQL or PHP developers can get their binaries (again from a command line window) by doing some thing like

    pfexec pkg install amp

    The Apache, PHP and MySQL binaries are available under /usr/apache2 , /usr/php5 and /usr/mysql directories respectively.  The corresponding configuration files are found under /etc/apache2 , /etc/mysql and /etc/php5 directories respectively.

\* Once you have successfully install MySQL or Apache , you will need to initialize the SMF service.  The following command does the initialization job for you. 

    pfexec /usr/sbin/svccfg import /var/svc/manifest/network/http-apache22.xml

    pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml

If in case, you wonder what is SMF - you might wanna check out Service Management Facility project page for more information on how this is useful to you. 

\* Now, you can start these Apache and MySQL services by doing something like

    pfexec /usr/sbin/svcadm enable network/http:apache22

    pfexec /usr/sbin/svcadm enable database/mysql:version_50 

 

Similarly, the way to stop these services, if you need to , you would do 

pfexec /usr/sbin/svcadm disable network/http:apache22

pfexec /usr/sbin/svcadm disable database/mysql:version_50 

 

 \* PHP runtime is configured by default within default Apache Service. So, you should be able to deploy PHP applications by simply writing a PHP application within Web Server document root directory - /var/apache2/2.2/htdocs.

That is all you need to do to get your web site up and running. If you want to do Joomla or MediaWiki, you can simply unpack these tar ball within the web server document root directory (/var/apache2/2.2/htdocs) and hit their index page . This is all you need to get them up and running.

Does this sound simple enough for you to try it out ?

Now, if you need to read more information on this , please check out the Getting Starting Guide from here . Kindly, give OpenSolaris 2008.05 a spin and let us as to what you think and how we can improve it

 



 

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