# DeviceAtlas Apache2 Module Installation #
Quick Start
There are 3 important steps for the usage of the DeviceAtlas C++ API and
Apache module.
- Make the API & module
- Install the shared libraries
- Configure Apache
Optional:
- Enable the client side component
** Dependencies **
- Apache web server headers
- Apr and Apr Utils (Apache Portable Runtime Library)
(Example for Red Hat based operating systems, the needed package
is httpd-devel (it will install related apr-devel and apr-util-devel packages),
for Debian based ones, the name is apache2-threaded-dev (it will install
related libapr1-dev and libaprutil1-dev packages). For ubuntu you can install
package apache2-dev for apache headers and include files. If your Apache headers
and/or Apr/Apr-util library and headers are located in custom locations you
have to set those cmake environment variables :
- APACHE_INCLUDE_DIR=<path to apache/httpd headers folder>
- APR_INCLUDE_DIR=<path to apr/apr-util headers folder>
- APR_LIBRARY=<path to apr library>
For example :
```shell
cmake ...
-DAPACHE_INCLUDE_DIR=/home/test/httpd/include
-DAPR_INCLUDE_DIR=/home/test/apr/include
-DAPR_LIBRARY=/home/test/apr/lib/libapr-1.so
```
32/64bit:
- This Apache module must be built according to Apache web server itself
(If Apache is 64 bits compliant, the module has to be too...)
** Step 1 **
a) EXTRACT PACKAGE
b) cmake . (or cmake -DCMAKE_SKIP_INSTALL_RPATH=1 if you do not wish to
link the Apache module to the current package location)
$ tar -zxvf deviceatlas_cpp-apache2_{version}.tar.gz
$ cd deviceatlas_cpp-apache2_{version}
$ cmake .
$ make
** Step 2 **
a) INSTALL SHARED LIB
b) INSTALL APACHE2 MODULE
$ cp api/libcommon.so /usr/lib
$ cp api/libdevatlas.so /usr/lib
$ cp api/libcarrierapi.so /usr/lib
$ cp api_modules/libmod_da.so /PATH/TO/MODULE_DIR
Module directory in Ubuntu 9.04:
/usr/lib/apache2/modules
** Step 3 **
Apache must be configured to load the DeviceAtlas module. The module is then
configured in the Virtual Host.
# Add to httpd.conf
"LoadModule da_module /PATH/TO/MODULE/libmod_da.so"
# Enable Module in virtual host
DA On
# (Optional)
# DAEnvironmentVars On (Device / Carrier properties set as environment variables
# by default they are set as request headers)
DAJsonFilePath /PATH/TO/JSON (If DeviceAtlas support)
DACarrierApiFilePath /PATH/TO/DATA FILE (If Carrier Identification support)
=> For more information/options check the apache2/virtualhost.*.conf files
** Step 4 (Optional) **
To use the Client Side Component with the Apache module, the Javascript file
located in ExtraTools/ClientSideProperties/ must be included on every webpage.
The client side component will create a cookie with the client properties. The
Apache module reads this cookie and merges the properties with the server
side detected properties.
The name of the cookie containing the client properties must be enabled in
the Virtual Host as follows:
DA On
DAIncludeUAProps On/Off (optional, enable the User-Agent properties, on by default)
DAIncludeLangProps On/Off (optional, enable the language locale properties, on by default)
DAJsonFilePath /PATH/TO/JSON (If DeviceAtlas support)
DAPropertiesCookie DAPROPS (If DeviceAtlas support)
DACarrierApiFilePath /PATH/TO/DATA FILE (If Carrier Identification support)
Please see the ExampleApp for additional information.
** Step 5 **
RESTART APACHE!
NOTE:
The Apache module prefixes all property names with "X-DeviceAtlas-" when
setting the properties in the request headers. For example the property
"mobileDevice" becomes a header called "X-DeviceAtlas-mobileDevice".
A PHP sample application is available for a test inside the ExampleApp,
you can copy those files to your DocumentRoot and try /index.php
** Common Errors **
When building Apache module if you see errors like
```
-- Could NOT find APACHE (missing: APACHE_INCLUDE_DIR)
-- Could NOT find APR (missing: APR_INCLUDE_DIR)
-- Could NOT find APR_UTIL (missing: APR_UTIL_INCLUDE_DIR)
APACHE module requires APR and APACHE headers - not found
```
You might have wrong paths set for Apache headers and include files,
please read Dependencies section for more details.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ Copyright (c) DeviceAtlas Limited 2021. All Rights Reserved. _