BigAdmin System Administration Portal
Community-Submitted Tech Tip
Print-friendly VersionPrint-friendly Version
This content is submitted by a BigAdmin user. It has not been reviewed for technical accuracy by Sun Microsystems, though it may have been lightly edited to improve readability. If you find an error or would like to comment on the article, please contact the submitter or use the comment field at the bottom of the article. Community submissions may not follow Sun trademark guidelines. For information on Sun trademarks, please see http://www.sun.com/suntrademarks/.
 
 

A Guide to SAMP (Solaris OS With Apache/MySQL/PHP)

Derek Crudgington, March 2006

If you're looking for a quick way to get Apache/MySQL/PHP running on the Solaris OS, then SAMP is for you. While SAMP is probably not the most secure, production-ready solution, it is a good way to get started quickly. SAMP is installed off the Solaris Companion CD, and getting it running really only takes a few minutes. The package is SFWsampc, and a good place for information on SAMP is /opt/sfw/READMEs.

I've broken the process down into two parts (configuring MySQL and configuring Apache/PHP). Let's get started...


Configuring MySQL

First we will start with MySQL. Check the /etc/sfw/mysql/README.solaris.mysql file. This file very simply explains how to get MySQL started.

Initialize the database tables:

# /usr/sfw/bin/mysql_install_db

After you run this command, take note of the command given to you to change the MySQL root user. We are going to run this at the end. Ignore what it says about starting the mysql daemon. We will use the start/stop script they supply with a manifest later.

Create mysql user and group and change data directory group:

# groupadd mysql
# useradd -g mysql mysql
# chgrp -R mysql /var/mysql
# chmod -R 770 /var/mysql
# installf SUNWmysqlr /var/mysql d 770 root mysql

Copy a mysql daemon configuration to /var/mysql:

# cp /usr/sfw/share/mysql/my-medium.cnf /var/mysql/my.cnf

Grab the mysql manifest from benr@cuddletech.com, so we don't have to use those horrible init scripts. This manifest is already configured to use the /etc/sfw/mysql/mysql.server start/stop script.

# wget http://cuddletech.com/opensolaris/smf/mysql.xml

Move it to the manifest directory, validate it, and import it.

# mv mysql.xml /var/svc/manifest/network
# svccfg validate /var/svc/manifest/network/mysql.xml
# svccfg import /var/svc/manifest/network/mysql.xml

Start MySQL and change the root password.

# svcadm enable mysql
# /usr/sfw/bin/mysqladmin -u root password 'new-password'

Configuring Apache/PHP

Check the /opt/sfw/READMEs/README.SFWmphp file. This tells us how to get PHP running with Apache.

Run the post install script. This script copies over our php.ini and libphp4.so module, and sets up our httpd.conf to be PHP aware:

# /opt/sfw/apache/x_postinstall

Use the default PHP-aware Apache configuration:

# mv /etc/httpd.conf-php-example /etc/httpd.conf

Grab an Apache manifest, validate, and import it:

# wget http://hell.jedicoder.net/files/http-apache.xml
# mv http-apache.xml /var/svc/manifest/network
# svccfg validate /var/svc/manifest/network/http-apache.xml
# svccfg import /var/svc/manifest/network/http-apache.xml

Browse to http://localhost/phpinfo.php and you're done.


About the Author
Derek Crudgington can be reached at dacrud@gmail.com, or you can check out his web site at http://hell.jedicoder.net.

 


The information and links on this page have been provided by a BigAdmin user. The submitter is solely responsible for such information and links. Sun is not responsible for the availability of external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. Sun will not be responsible or liable, directly or indirectly, for any actual or alleged damage or loss caused by or in connection with use of or reliance on the information posted here, or goods or services available on or through any external site or resource.

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
BigAdmin
  
 
 
 
Would you recommend this Sun site to a friend or colleague?
Contact About Sun News & Events Employment Site Map Privacy Terms of Use Trademarks Copyright Sun Microsystems, Inc.