LikeYou
LikeYou

Reputation: 500

Write PHP variables into apache log

Is there a way to write PHP variables (and arrays) into apache log? To have some server-side debugging ablility directly?

Upvotes: 0

Views: 307

Answers (1)

Vavilen T
Vavilen T

Reputation: 87

You can use error_log function. It will log to the web server error log regarding the its settings. It will work in any case - apache, nginx, php-cgi, php-fpm

To write variables you can use

error_log('MyObject is '.var_export($my_object, true));

Upvotes: 3

Related Questions