Difference between revisions of "Web Server"
m |
m |
||
Line 20: | Line 20: | ||
I installed the Oracle OCI interface, specifically the "Oracle 10 Instant Client" to | I installed the Oracle OCI interface, specifically the "Oracle 10 Instant Client" to | ||
/usr/local/pkgs/oracle/instantclient_10_2 | /usr/local/pkgs/oracle/instantclient_10_2 | ||
− | + | ||
+ | Needed both the Basic and SDK versions from: | ||
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html | http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html | ||
+ | instantclient-basic-linux32-10.2.0.3-20061115.zip | ||
instantclient-sdk-linux32-10.2.0.3-20061115.zip | instantclient-sdk-linux32-10.2.0.3-20061115.zip | ||
This part simply required to 'unzip' the files to the directory. | This part simply required to 'unzip' the files to the directory. | ||
− | |||
− | |||
The directions at http://ubuntuforums.org/archive/index.php/t-92528.html were very helpful. The basic steps I did, I think, were: | The directions at http://ubuntuforums.org/archive/index.php/t-92528.html were very helpful. The basic steps I did, I think, were: | ||
Line 44: | Line 44: | ||
Install OCI8: | Install OCI8: | ||
− | pecl install oci8 | + | pecl install oci8 (don't remember if I had to install 'pear' before using pecl?) |
− | ORACLE_HOME = instantclient,/usr/local/pkgs/oracle/instantclient | + | Answer ORACLE_HOME = instantclient,/usr/local/pkgs/oracle/instantclient |
− | Modify the php.ini file: | + | Modify the /etc/php/apache2/php.ini file: |
− | + | Add: | |
− | + | extension=oci8.so | |
Add the environment variables to apache: | Add the environment variables to apache: |
Revision as of 17:35, 18 October 2007
This entry contains information on the packages installed in the web server and the process followed for their installation.
The Wiki began very late in the process, so it will be completed slowly over time.
PHP
GD Library
Since I used a non-graphical utility to get weather data, I have to make my own graphics... so I wanted to use the GD library. While the default installation is supposed to have GD installed, something was not working.
Patrick Lam helped me out by deleting the old library:
rm /usr/local/lib/libgd*
and then restarting apache. (He used "/etc/init.d/apache2 restart" instead of what I used: "apache2 -k restart", although both should work).
This entry helps me remember how to delete old libraries which may be 'corrupt' (the current guess is that when installing things for gallery2, the gd library was corrupted).
Data Warehouse (Oracle) Access
In order to get access to the data Warehouse, I had to install PHP support for Oracle.
I installed the Oracle OCI interface, specifically the "Oracle 10 Instant Client" to
/usr/local/pkgs/oracle/instantclient_10_2
Needed both the Basic and SDK versions from:
http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html instantclient-basic-linux32-10.2.0.3-20061115.zip instantclient-sdk-linux32-10.2.0.3-20061115.zip
This part simply required to 'unzip' the files to the directory.
The directions at http://ubuntuforums.org/archive/index.php/t-92528.html were very helpful. The basic steps I did, I think, were:
mkdir -p /usr/local/pkgs/oracle/instantclient_10_2 cd /usr/local/pkgs/oracle/instantclient_10_2 unzip instantclient-basic-linux32-10.2.0.1-20050713.zip unzip instantclient-sdk-linux32-10.2.0.1-20050713.zip echo /usr/local/pkgs/oracle/instantclient_10_2 >> /etc/ld.so.conf ldconfig
Create symbolic links:
ln -s libclntsh.so.10.1 libclntsh.so ln -s libocci.so.10.1 libocci.so
Install OCI8:
pecl install oci8 (don't remember if I had to install 'pear' before using pecl?) Answer ORACLE_HOME = instantclient,/usr/local/pkgs/oracle/instantclient
Modify the /etc/php/apache2/php.ini file:
Add: extension=oci8.so
Add the environment variables to apache:
To: /etc/apache2/envvars Add: LD_LIBRARY_PATH="/usr/local/apache2/lib:/usr/lib/oracle/10.2.0.3/client:$LD_LIBRARY_PATH" TNS_ADMIN="/usr/lib/oracle/10.2.0.3/client" LANG=en_US export LD_LIBRARY_PATH LANG TNS_ADMIN
(But I'm not sure if this did anything, I had to use "PutEnv" in the PHP code, see below).
Lastly, I had to modify the Oracle files to tell it where the MIT Data Warehouse is:
Create /usr/local/pkgs/oracle/instantclient_10_2/tnsnames.ora With data:
warehouse = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = warehouse.mit.edu)(PORT = 1521)) ) (CONNECT_DATA = (SID = DWRHS)) )
and nothing else in it. THIS IS ESSENTIAL!
To connect to the DW in PHP, I created the interface file oracle.php, with the following basic elements:
PutEnv("ORACLE_SID=DWRHS"); PutEnv("ORACLE_HOME=/usr/lib/oracle/10.2.0.3/client/"); PutEnv("TNS_ADMIN=/usr/lib/oracle/10.2.0.3/client/"); PutEnv("LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib"); function ora_query($sql,&$err) { $conn = oci_pconnect('sailuser','sail2WAREhouse','warehouse'); if (!$conn) { $err = "No connection!"; return false; } // empty the error $err = ""; // parse the query string $stid = oci_parse($conn,$sql); if (!$stid) { $err = oci_error($conn); return false; } // execute the actual query $res = oci_execute($stid, OCI_DEFAULT); if (!$res) { $err = oci_error($stid); return false; } return $stid; }
function ora_fetch_array($res) { return oci_fetch_assoc($res); }
These work mostly equivalent to the mysql 'query' and 'fetch' functions.
Weather Station
The Weather Station is a Vantage Pro2 hard wired model.
NEW
W View did not make me happy (it could not give 'real-time' results, only show things about every minute or even more... plus I could not get it to save data to the database to interface easily with PHP.
So, I looked more around, and found this super easy program to use:
http://www.joejaworski.com/weather/
Since our station is in USB and next to the computer, the ONLY software needed is:
vproweather http://www.joejaworski.com/weather/vproweather-0.6.tgz
I downloaded/untared it to:
/usr/local/pkgs/vproweather-0.6/
A simple 'make' (using sudo) was all that was needed to compile it. Then, running it with:
/usr/local/pkgs/vproweather-0.6/vproweather -x /dev/ttyUSB0
Gives real time data, and using '-l' instead of '-x' gives low/high data.
I put this in a cron to run the real-time every 1 minute (fastes crontab can do) and update a table in the database, which is then used by the rest of the site (table: weather). The low/high will run once a day.
Hopefully I'll be able to create a daemon which updates the table every 10 seconds or so... we'll see.
OLD
The linux software is W View. I followed the User Manual detailed instructions.
Install (untar) to:
- /usr/local/pkgs/wview-3.3.0
Commands (what should be done next time in order, I did not do it in this order):
- Installed mysqlclient-dev: sudo apt-get install libmysqlclient-dev
- Installed libpng-dev: sudo apt-get install libpng12-dev
- Install 'radlib':
- get .tar
- install to /urs/local/pkgs/radlib-2.7.0
- ./configure
- make
- sudo make install
- edit /etc/ld.so.conf --> add /usr/local/lib --> run ldconfig
- Install 'libgd' (all with sudo):
- get .tar
- install to /usr/local/pkgs/gd-2.0.35
- ./configure
- make
- make install
- ./configure --enable-mysql
- sudo make
- sudo make install
Not working! Will need to check USB drivers/connection