Logging3:54 with Alena Holligan
Displaying errors to the screen during development is just the first step. The developer won't always run across every possible error and what about errors that happen in production? That’s where logging comes in.
.htaccess file, as mentioned in Before You Start, is only applicable for locally hosted servers or a hosting server you have access to. If you'd like to follow along with that part of this video, make sure that you are developing using a local PHP Dev Environment.
Settings for Your PHP File
Open logging.php. At the top of the file we have some log options using the ini_set function:
Settings for an .htaccess File
# log errors
php_value log_errors 1
# log file for errors
php_value error_log php-error.txt
Settings for the php.ini File
Replace the following path with the full path your log file.
log_errors = On
error_log = "/Applications/MAMP/htdocs/php-error.txt"
You need to sign up for Treehouse in order to download course files.Sign up