SmartOS LAMP Install

I'm starting to work with our smart data center project. I stumbled around looking for a recipie and came up with this basic list of instructions for getting a LAMP stack on a sdc:sdc:base64:13.1.0 image.

Objective - setup a lamp install, then install Drupal 7
Apache 2.4
pkgin install apache
pkgin install mysql-server, mysql-client
sudo pkgin install php54 php54-extensions-5.4.13
NOTE: the php54-extensions drops lots of extras module files into /opt/local/lib/php/20120301
Configure Apache
- need to make the standard entries for PHP (LoadModule, AddHandler)
- need to make the standard entry for index.php
- added a symlink for the htdocs dir to point to the recommended drupal file path
- learn the SmartOS commands for svcs -a, sudo svcadm resstart apache
- test your connection at http://x.x.x.x
Configure PHP
- add extension_dir path of /opt/local/lib/php/20120301
- add extensions: (YMMV depending on needs)
- create a phpinfo file to review Apache/PHP config
- turn on display_errors in php.ini for initial debugging info
Configure MySQL
- secure the default MySQL install with a root password
- edit /opt/local/my.cnf as needed.
- create a sample database, create a table, create a couple of rows of data (see below for some scripts)
- create a mysql-test.php file to determine connection success
Install Drupal
- use the built in instructions at Note that you need to use MySQL root credentials if you haven't created a user with admin priv's.
- note the db_name, db_user, db_pass that come back from the script. They are need in the install.php portion for Drupal
- I was getting a json_encode fatal error. That made me go back and add more extensions (first json, then pdo). I may have more extensions on that I actually need.
Helper Scripts
This one will help get a connection to a MySQL database
This one will help create a sample potluck database.
You'd need to adjust the script to like this:
$query = "SELECT * FROM `potluck`";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
        if($result->num_rows > 0) {
                while($row = $result->fetch_assoc()) {
                        echo stripslashes($row['food']);        
        else {
                echo 'NO RESULTS';      

Add new comment

By submitting this form, you accept the Mollom privacy policy.