# 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=&lt;path to apache/httpd headers folder&gt; - APR_INCLUDE_DIR=&lt;path to apr/apr-util headers folder&gt; - APR_LIBRARY=&lt;path to apr library&gt; For example : ```shell cmake <other environment variables> ... -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) $ unzip deviceatlas-enterprise-cpp-{version}.zip $ cd deviceatlas-enterprise-cpp-{version}/modules/apache2 $ 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 <VirtualHost *:80> 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) </VirtualHost> => 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: <VirtualHost *:80> 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) </VirtualHost> 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. _ <!-- HTML+JS for document formatting when opened in browser --> <div class="btn-group" id="main-menu" style="float:right"><a class="btn dropdown-toggle" data-toggle="dropdown" href="#">Menu<span class="caret"></span></a><ul class="dropdown-menu"><li><a href="README.html">Main</a></li><li class="divider"></li><li><a href="README.DeviceApi.html">Device Detection API</a></li><li><a href="README.DeviceApi-Config.html">Device Detection API Config</a></li><li><a href="README.CarrierApi.html">Carrier Identification API</a></li><li><a href="README.Windows.html">C++ API and Windows</a></li><li class="divider"></li><li><a href="README.ClientSide.html">Client-side Component</a></li><li class="divider"></li><li class="disabled"><a href="README.Apache2.html">Apache2 Module Installation</a></li><li><a href="README.ConnectivityAnalyser-Apache2.html">Apache 2 Connectivity Analyser</a></li><li class="divider"></li><li><a href="README.IIS.html">HTTP Module / ISAPI Filter 2.1 Installation</a></li><li class="divider"></li><li><a href="ApiDocs/index.html">DeviceAtlas ApiDocs</a></li></ul></div>