LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   what is the right way to create debug messages in php (the interpreter itself)? (https://www.linuxquestions.org/questions/programming-9/what-is-the-right-way-to-create-debug-messages-in-php-the-interpreter-itself-4175419421/)

eantoranz 07-30-2012 03:18 PM

what is the right way to create debug messages in php (the interpreter itself)?
 
Hi!

I'm hacking php (the interpreter itself) and I have created a number of fprintf(stderr, "blahblah", blah, blah) messages that work like a charm in php cli but now I want to debug it in apache. How is it done? I noticed my messages don't show up either in apache's error.log or access.log so I guess I'm either looking at the wrong place or it's not the right way to do it.

Thanks in advance

eantoranz 07-30-2012 04:49 PM

ap_log_error() seems to be the way to do it.

I have included http_log.h in the c file I'm working on but now I get this:

Code:

/usr/include/apache2/http_log.h:94:28: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ap_default_loglevel’
/usr/include/apache2/http_log.h: In function ‘AP_DECLARE’:
/usr/include/apache2/http_log.h:102:18: error: expected declaration specifiers before ‘ap_open_stderr_log’
/usr/include/apache2/http_log.h:109:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:122:37: error: unknown type name ‘server_rec’
/usr/include/apache2/http_log.h:171:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:195:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:219:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:245:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:254:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:261:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:269:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:272:26: error: storage class specified for parameter ‘piped_log’
/usr/include/apache2/http_log.h:280:1: warning: empty declaration [enabled by default]
/usr/include/apache2/http_log.h:305:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:314:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:322:1: error: expected declaration specifiers before ‘AP_DECLARE’
/usr/include/apache2/http_log.h:350:1: error: expected declaration specifiers before ‘AP_DECLARE_HOOK’

Plus a lot of other stuff.

What's going on?

eantoranz 07-30-2012 05:02 PM

Ok.... a few includes where missing:

Code:

#include <apr.h>
#include <httpd.h>
#include <ap_config.h>
#include <http_log.h>

But I'm missing a typedef:

Code:

/usr/include/apr-1.0/apr.h:362:1: error: unknown type name ‘off64_t’
Line in question in apr.h?
Code:

typedef  off64_t          apr_off_t;
What am I missing now?

eantoranz 07-30-2012 05:18 PM

I have included sys/types.h but I still get the same error.

Code:

#include <sys/types.h>
#include <apr.h>
#include <httpd.h>
#include <ap_config.h>
#include <http_log.h>


NevemTeve 08-01-2012 01:13 AM

Compile with option -D_LARGEFILE_SOURCE


All times are GMT -5. The time now is 10:26 PM.