0

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

1
  • 1
    It is possible under some circumstances. But please consider this solution as dirty. A PHP-Application should use it's own logging-functionality. Commented Oct 28, 2014 at 15:35

1 Answer 1

3

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));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.