In the case you need to quickly see if certain code path is executed on a production server for which config cannot be changed.
file_put_contents("/tmp/log.txt", "this is a test entry\n");
The proper method would be
- Configure error log in php.ini
- Use error_log()
- …. or use logging facility of your PHP framework
Subscribe to RSS feed Follow me on Twitter Follow me on Facebook Follow me Google+
Also for appending log add
file_put_contents($file, $data FILE_APPEND)