Macro Engine Configuration

As of Jedox 2021.3, PHP Macro Engine in Jedox Spreadsheet Server uses PHP version 7.

ME is called by the following entry in the file .../Jedox Suite/core/config.xml (Windows) or .../core-Linux-i686/etc/config.xml (Linux):

Copy
<extension name="macro_engine" config="macro_engine_config.xml" />

ME has different configuration options that are set in the file macro_engine_config.xml. These options are mainly various PHP statements, which are normally in the php.ini. Furthermore, included are the user-defined functions, which should be available server-wide. To prevent users from writing custom macros for specific functions, you can disable those functions in macro_engine_config.xml. Use the parameter disable_functions in the ini_directives section.

Jedox uses PHP version 7. Custom scripts written for PHP 5 may require modifications, depending on their complexity. Sample scripts shipped by Jedox (e.g. for Drillthrough) do not require any changes. A list of required changes is available in the PHP documentation https://www.php.net/manual/en/migration70.php.

The following is an example of a macro_engine_config.xml:

Copy
<?xml version="1.0" encoding="utf-8"?>
<php_macro_engine_config xmlns="http://www.jedox.com/jedox/wss"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <php_extensions directory="php_extensions">
        <extensions>
            <extension extension_file="php_curl.dll" />
            <extension extension_file="php_jedox_palo_x64.dll" />
            <extension extension_file="phpchartdir560.dll" />
        </extensions>
    </php_extensions>
    <php_files directory="php_macros" temp_directory="tmp" >
        <include_paths>
            <include_path path="base" relative="true" />
            <include_path path="lib" relative="true" />
        </include_paths>
    </php_files>
    <ini_directives>
     default_socket_timeout = 240
     memory_limit = 256M
     max_execution_time = 90
     max_input_time = 90
     date.timezone = "Europe/Berlin"
     open_basedir = "php_macros;tmp"
     zend_extension="../php_extensions/php_opcache.dll"
     opcache.enable=1
     opcache.memory_consumption=64
     opcache.use_cwd=1
     opcache.validate_timestamps=1
    </ini_directives>
    <general_settings>
        <console_echo>false</console_echo>
        <loglevel>error</loglevel>
    </general_settings>
      <functions>
        <function spreadsheet_function="RESOLVE" php_file="base/macro/fns/misc.php" php_function="RESOLVE" always_recalc="false" />
    </functions>
    </php_macro_engine_config>

When you trigger an Integrator job from Macro and you wait in the Macro until the job is finished, you will receive an error in all cases when the job takes more than 60 seconds. You can prevent this with the following entry inside the tag <ini_directives>:

Copy
 default_socket_timeout = 240

If you update from an older version to the latest version, you have to manually copy all custom libraries (files) from ../httpd/app/lib to ../core/php_macros/lib (Windows) and from ../httpd/app/lib to ../core-Linux-x86_64/php_macros/lib (Linux).

Additional configuration

The Integrator interface and port are exposed in the Macro engine. This provides the ability to write the Macros accessing integrator independently and without knowing the specific platform configuration.

The default URL for ETL service in the config.xml is:

Copy
<etl_service url="http://127.0.0.1:7775" />

It can be accessed through $_JEDOX global with the Macro engine as:

Copy
$_JEDOX['ETL_SERVICE_URL']

Enabling PHP 7 for Jedox Macro Engine

In Jedox versions 2021.1 and 2021.2, PHP 7 is in preview and must be configured as follows:

On Windows: open config.xml and change the macro_engine line to

Copy
<extension name="macro_engine" lib="macro_engine_php" config="macro_engine_php_config.xml" />

On Linux: open config.xml and change the macro_engine line to

Copy
<extension name="macro_engine" lib="macro_engine_php" config="etc/macro_engine_php_config.xml" />

See also Macro Engine Overview.

Updated September 27, 2022