This workshop will be retired on May 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Start a free Courses trial
to watch this video
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.
The .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:
ini_set("log_errors", 1);
ini_set("error_log", "php-error.txt");
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"
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up