TOTAL
Since dec 2006
1'942'871 Visitors
4'218'042 Pages

Nov 2010 Stats
82'909 Visitors
146'476 Pages
196 countries
Full statistics



Help us translate
our tutorials!

JOIN the
OpenManiak Team.
OM TEAM
Director:
Blaise Carrera
Tutorials creation:
Blaise Carrera
Translaters:
Giovanni Fredducci
Angel Chraniotis
Moham. H. Karvan
Alexandro Silva
Blaise Carrera
Andrei Chertolyas
Sergiy Uvarov
Nickola Kolev
Łukasz Nowatkowski
Ivo Raisr
Catalin Bivolaru
Bogdan A. Costea
Kirill Simonov
Oliver Mucafir
JaeYoung Jeon
Seungyoon Lee
Jie Yu & Si Cheng
Tao Wei
YukiAlex
Fumihito Yoshida
Muhammad Takdir
Çağdaş Tülek
Auditors
Leslie Luthi
Joe Anderson
Jennifer Ockwell
Nigel Titley
Alison Rees
Webmaster:
Blaise Carrera
PHP WEATHERMAP - The Easy Tutorial - Installation

Weathermap Tutorial
Last Change : Feb 22 2008 french flagenglish flag


Tool
Install
Ergonomy
Forum



Details What is PHP Weathermap ?
Screenshots
Prerequisites
Tutorial Weathermap
Cacti Plugins



⚠️⚠️⚠️
Please check our website about
attractions in Western Switzerland !! (Please use english translation).

⚠️⚠️⚠️
Merci de consulter notre site sur les
activités à faire en Suisse romande !!


In this tutorial, we will present the PHP Weathermap standalone installation tutorial. Let us remind you that we recommend installing PHP Weathermap as a cacti plugin for ease of installation and use reasons.

Let's begin the PHP Weathermap standalone installation.

Once PEAR is installed (see the prerequisites), we need to make sure that we have a library called Console_Getopt. This library should be installed by default.
To check whether or not it is indeed the case:

#pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.1 stable
Console_Getopt 1.2 stable
PEAR 1.4.6 stable


If you don't have Console_Getopt, you can download and install it with the following pear command:

#pear install --force Console_Getopt
Download and uncompress PHP Weathermap.

#tar -xvf php-weathermap-0.9.zip
Copy the uncompressed directory to /var/www/ . We suppose we downloaded it in the /home/blaise/Desktop/php-weathermap-082 directory.

#cp /home/blaise/Desktop/php-weathermap-0.9 /var/www/
First thing to do is to check if the weathermap script can be launched:

#php5 weathermap
This command will create or update a file called weathermap.png in this same directory.

If you receive a message saying that php5 was not found, proceed as follows:
Open the weathermap file in the weathermap directory and change the first line to indicate the correct way to find php5.

#!/usr/bin/php5
In the /var/www/weathermap/weathermap file, you can find settings about the weathermap tool.
The map configuration file will be stored (even it is not mandatory) in the /var/www/weathermap/configs directory. A complete documentation about this can be found at the PHP Weathermap website.

A very useful editor is available to manage your map more easily especially if you are a beginner. For fine tuning, you will still need to edit the configuration files.

Copy the editor-config.php-dist file to editor-config.php

#cp /var/www/weathermap/editor-config.php-dist /var/www/weathermap/editor-config.php
Then open the editor.php file using your favorite browser:

http://localserver/weathermap/editor.php

The web server is launched by a user called www-data who will need to have a write permission on the /var/www/weathermap/configs directory:

#chown -R www-data /var/www/weathermap/configs
You should be aware that anyone using a web browser could change your weathermap pictures ... . To avoid any bad surprises, once you have finished configuring your pictures, change the ownership of the configs directory from www-data to another user.

The configuration files generated by the editor will be stored in the configs directory. You can of course create them manually as well.

You must set the path to a rrd file for each weathermap link. You can either do it "manually" or using help from the editor. Please see this link to obtain information about how to get data with RRDTOOL. Tools like Cacti or MRTG can help you to generate rrd files.

Now change the ownership of the weathermap directory and the files included in it to a user of your choice. It's safer not to leave root as the owner.

#chown -R blaise /var/www/weathermap/
The last thing to do is to add a cron job to run the "php5 /var/www/weathermap" command periodically:

#crontab -e -u blaise
The crontab command will update the /var/spool/cron/crontabs/blaise file.

Add the following line in the crontab which will call the command every 5 minutes:

*/5 * * * * php5 /var/www/weathermap/weathermap --config configs/net_europe.conf --output output/net_europe.png --outputhtml output/net_europe.html
Here we have a configuration file named configs/net_europe.conf. The graphs generated by the phpweathermap script will be stored in the output directory as two separate files.