Linux hosting plans:
To turn on error logging for a php file where you want it to print the errors to the screen when you view a webpage put the following code at the top of the php file you are having a problem with:
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
Please note that errors are already logged on our linux plans so you only need to set the above if you want the errors to show on the webpage itself, as well as being logged. You can access your logs, if on cp.blacknight.com, under:
Web Sites > domainname > More Tools > Log Manager
Windows 2008/2012 Hosting Plans:
These instructions only apply to Windows 2008/2012 hosting packages on our cp.blacknight.com system.
First you need to edit your web.config file and integrate the following in to it (note - you might already have some of these sections in your web.config file):
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Detailed" />
</system.webServer>
</configuration>
If you don't have a web.config file create one in your webroot folder, or in the folder the problematic php file is in, and put the above in to it.
This will set the php errors to print on your webpage. If you want it to log the PHP errors to a file instead then integrate the following code in to any PHP file causing the error:
<?php
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
?>
The folder that the error_log.txt file is to go into will have to have writeable permissions set for PHP - that file will be created in the same folder as the file you are putting the above into. For how to change the permissions on our Windows packages please see here:
https://help.blacknight.com/entries/22941898-changing-permissions-of-files-or-folders
Comments
0 comments
Article is closed for comments.