简体   繁体   中英

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?

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));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM