Best practices for developing/debugging PHP macros

I've been spending the last few weeks trying to write new macros for my web spreadsheet.

Here's the cycle I've been following when I do my new macro development:
1. Create/edit a new macro using Tools -> Macros -> Macro Editor.
2. Create a button in spreadsheet.
3. Add macro to button.
4. Press button.
5. In veritably, macro doesn't work but there is no popup or other indication on spreadsheet that macro failed.
6. Using System Manager -> Logs and 7-9 clicks, get the most recent failures (or better yet, since log messages are truncated) do tail -f logs/core.logs
7. Look for error related to [php_macro_engine] (even though this is a spreadsheet failure). Error looks something like this:

8. Edit the tmp file using vi/emacs and look for line with error in it. In case above error is undefined function, otherwise you'll need to hunt and peck to see why the PHP failed.
9. Correct the error if obvious. If not obvious insert the following statement to get a popup with various variables populated.

I'd like to find out the best way to develop macros because this debug loop is getting pretty tiresome.

I'm also thinking there are at least 3 improvements Jedox could make to make this process better.
1. Add PHP syntax checking when user selects that "save" icon in the PHP editor page. I think the editor does some rudimentary checking but I think validating it against known functions might be better.
2. Add a PHP debug error pane/popup would be nice too. That way the developer doesn't need to pop out to shell or log app to investigate error.
3. Provide context in error dump in logs or error pane. Providing the +-3 line context around the failure would make debugging these issues a lot less painful.

Regarding the missing detailed error message for an omitted semicolon, our default PHP error reporting level didn't include this particular type of PHP error (E_PARSE). In the file macro_engine_config.xml you have a line that controls the macro engine log level, by default it's "error":
<functions loglevel="error">

This "error" log level was translated to PHP's E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR.

I've now fixed it to include E_PARSE and E_USER_ERROR. You don't have to wait for the new version, you can just change the log level to "debug":
<functions loglevel="debug">

You'll now get all types of errors.

Regarding global palo_* functions vs. application-level ones, they aren't "coming" from the same place. Global ones are coming from the Jedox PHP extension (libphp_jedox_palo.so) that extends PHP with a set of Jedox OLAP PHP functions (you can decide not to load this extension by commenting it out in macro_engine_config.xml). The application-level ones are actually spreadsheet functions, i.e. equivalent to functions you would type in a spreadsheet cell, e.g. you can do stuff like application()->sum(1,2,3)...

I found macro_engine.config.xml in core-Linux-i686/etc. I hope that's the right one to change. And thanks for explanation about the difference between the global palo functions and application functions. Its good to know how all of these pieces fit together.

AHA!

Also found a line for date.timezone = "Europe/Berlin" in this file. I'll *definitely* be changing that too!

As for the time zone, macro_engine_config.xml controls the PHP inside the Spreadsheet Server (Core). For PHP running inside Apache (e.g. backend for the Log viewer), there's a php.ini file. There's also another php.ini for the OLAP's Supervision Server (SVS).