There is not much documentation on how one can possibly test if Apache, MySQL and PHP have been installed properly after having built the package from Glassfish 1.5. I will go into some detail on how you can go about this.

I found the following guidelines extremely helpful while installing AMP on Solaris 10 : http://googlux.com/sunwebstack.html

This is the complete SUN documentation for the same : http://wikis.sun.com/download/attachments/111411306/GFWSICFG.pdf

To verify web server is running fine :

I will now provide the next step, that is testing whether PHP is working with your up and running web server, Apache. Before that, I am assuming that you have started the web server, you can verify the same by checking against the installed services :

bash-3.00$ svcs -a |grep apache
online Nov_16 svc:/network/http:sun-apache22

If not, start the server as described in the above documents.

To verify PHP is working and well configured with Apache :

  1. Go to the following directory : bash-3.00$ pwd
    /var/opt/webstack/apache2/2.2/htdocs
  2. Create a test file with .php extension : vi test.php
  3. Insert the following code :
    <?php phpinfo(); ?>
  4. Now open up a browser and enter the URL : http://server-name/test.php. If you are running the webserver locally, you can enter http://localhost/test.php

What just happened ?

The webserver looks inside the Document Root /var/opt/webstack/apache2/2.2/htdocs” to find the source files. This is the location defined by default in httpd.conf, a configuration file which defines several parameters, for eg, the port to be used to access the website, and the DocumentRoot location. You can change the location as per your convenience/requirement. If you do so, restart Apache to make sure the webserver picks up these changes.

bash-3.00$ pwd
/etc/opt/webstack/apache2/2.2

bash-3.00$ ls -lrt httpd.conf

-rw-r–r– 1 root bin 13534 Jul 14 22:51 httpd.conf

bash-3.00$ cat httpd.conf | grep DocumentRoot
# DocumentRoot: The directory out of which you will serve your
DocumentRoot “/var/opt/webstack/apache2/2.2/htdocs”
# This should be changed to whatever you set DocumentRoot to.
# access content that does not live under the DocumentRoot.

We then created a php file named test.php, and inserted 1 line of code. phpinfo() is a function which outputs information regarding the current state of php, that is the version number, configuration parameters, server properties to name a few.

Then we simply opened a browser and entered the corresponding URL. If PHP is working and recognized by Apache web server, you should be able to see a page full of PHP related information. It looks something like this :

If all goes well, you can be sure php and apache are working fine on your Solaris box!!

I will add more details regarding testing MySQL soon..

Advertisements