I feel like adding more details to the existing answer:
# PHP error handling for development servers
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_flag ignore_repeated_errors off
php_flag ignore_repeated_source off
php_flag report_memleaks on
php_flag track_errors on
php_value docref_root 0
php_value docref_ext 0
php_value error_log /full/path/to/file/php_errors.log
php_value error_reporting -1
php_value log_errors_max_len 0
Give 777 or 755 permission to the log file and then add the code
<Files php_errors.log>
Order allow,deny
Deny from all
Satisfy All
</Files>
at the end of .htaccess.
This will protect your log file.
These options are suited for a development server. For a production server you should not display any error to the end user. So change the display flags to off.
For more information, follow this link: Advanced PHP Error Handling via htaccess
AllowOverride All
in the Apache config, if you have access to that. – Jarad