The basic installation of wview using MacPorts will provide a working version of the program, but some features (e.g., wviewmgmt) will require installation of additional libraries and/or editing of configuration files. This page provides step-by-step instructions for installing the additional ports using MacPorts and making the necessary edits to the configuration files. (These instructions assume you're using vi as the editor, but you can substitute any editor of your choice.)
Since you need to compile these programs from source, you'll need to have Apple's Xcode development environment installed. Xcode can be downloaded from the App Store.
After installing Xcode, launch the application to accept the User Agreement. Select Preferences from the Xcode menu, click Downloads, and install the Command Line Tools. Once the installation of the command-line tools is complete, run the following command in a terminal window:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Note: Although apache2 and php5 are already part of the OS X distribution, we're going to install all of these packages using MacPorts in order to get the latest versions and to be able to install other extensions (e.g., php5-sqlite).
Download and install MacPorts (download the Mac OS X package from http://www.macports.org)
After installing the MacPorts package, update the portfile definitions:
1> sudo port -d selfupdate
2> sudo port install apache2
If it's currently running, turn off the web server that's included with Mac OS X. Go to System Preferences, click Sharing, and uncheck the checkbox next to "Web Sharing".
Set up the MacPorts version of apache2 to launch automatically:
3> sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist
4> sudo port install php5 +apache2
5> sudo port install php5-sqlite
6> cd /opt/local/apache2/modules
7> sudo /opt/local/apache2/bin/apxs -a -e -n php5 libphp5.so
8> cd /opt/local/etc/php5
9> sudo cp php.ini-production php.ini
10> sudo vi php.ini
Find the "date.timezone =" line, uncomment it, and set the appropriate timezone:
date.timezone = "America/Chicago"
For a list of supported timezones, see: http://us2.php.net/manual/en/timezones.php
11> sudo vi /opt/local/apache2/conf/httpd.conf
[OPTIONAL] This will allow access to the /Users/*/Sites directories.
Find the line:
#Include conf/extra/httpd-userdir.conf
and uncomment it.
[OPTIONAL] This will set the default directory that's used if the url does not include a path.
Find the line:
DocumentRoot "/opt/local/apache2/htdocs"
and change it so that your weather site is the default page:
DocumentRoot "/Users/<username>/Sites/wview"
[OPTIONAL] This will load an index.php or index.html file if the user uses a url with a directory name only (i.e., no file name)
Find the line:
DirectoryIndex index.html
and change it to:
DirectoryIndex index.php index.html
Add the following lines at the end of the file:
#
# Include PHP and wviewmgmt configurations
#
Include conf/extra/mod_php.conf
Include conf/extra/httpd-wviewmgmt.conf
12> sudo vi /opt/local/apache2/conf/extra/httpd-userdir.conf
Add the following lines at the end of the file:
#
# Include user configurations
#
Include /private/etc/apache2/users/*.conf
13> sudo vi /opt/local/apache2/conf/extra/httpd-wviewmgmt.conf
Add the following lines:
AliasMatch ^/wviewmgmt(?:/)?(/.*)?$ "/opt/local/www/wviewmgmt$1"
<Directory "/opt/local/www/wviewmgmt">
Options -Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
14> sudo /opt/local/apache2/bin/apachectl restart
15> sudo port install wview
The default location for web pages in Mac OS X is /Users/username/Sites. To keep the wview files separate from other web pages, I prefer to create a directory called wview inside the Sites directory.
16> mkdir /Users/username/Sites/wview
Follow the user manual for detailed instructions on configuring wview. In most cases where wview will not run, the problem is with the configuration. In particular, with an OS X installation, be sure to set the directory paths correctly (e.g., /opt/local rather than /usr/local).
Command-Line Configuration
17> sudo /opt/local/bin/wviewconfig
Follow the command prompts to enter the correct values. In particular, pay attention to the following parameters:
| STATION_TYPE | Simulator, VantagePro, WXT510, WS-2300, WMR918 |
| STATION_INTERFACE | serial or ethernet |
| STATION_DEV | /dev/ttyS0, /dev/ttyUSB0, etc. |
| STATION_HOST | Hostname or IP address (ethernet only) |
| STATION_PORT | TCP port to the weather station (ethernet only) |
| HTMLGEN_IMAGE_PATH | /Users/userid/Sites/wview |
| HTMLGEN_HTML_PATH | /opt/local/etc/wview/html |
Browser-based Configuration
[OPTIONAL]
To enable starting and stopping wview from the web interface, it will be necessary to add the _www user to the sudoers file. If you choose not to do this step, you can still start and stop wview using the command line commands: "sudo /sbin/SystemStarter start wview" and "sudo /sbin/SystemStarter stop wview".
Note that adding _www to sudoers may be a security vulnerability and should be done at your own risk.
17> sudo visudo
Add the following line to the end of the file:
%_www ALL= NOPASSWD: /sbin/SystemStarter
Point your browser to http://localhost/wviewmgmt/login.php and modify settings. See the wview User Manual for detailed configuration instructions.
Choose the skin for the html output:
18> sudo /opt/local/bin/wviewhtmlconfig
Modify /etc/syslog.conf to report all messages
[OPTIONAL]
Ensure that all messages are sent to the system.log:
19> sudo vi /etc/syslog.conf
Add "*.*;" to the beginning of the second line:
*.*;*.notice;authpriv,remoteauth,ftp,install.none;kern.debug;mail.crit /var/log/system.log
Startup wview
20> sudo /sbin/SystemStarter start wview
Check /Applications/Utilities/Console.app to check for any error messages.
> sudo /sbin/SystemStarter stop wview
> sudo port -d selfupdate
> sudo port -u upgrade outdated
> sudo /sbin/SystemStarter start wview