Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 837
  • Last Modified:

enable PHP errors with htaccess?

I have a PHP script that works fine on my development server but not with my production server that's hosted somewhere else.
The problem is I don't get an error message so I suspect my hosting company has disabled error messages for security reasons.
I would like to enable the PHP error messages on a specific folder with htaccess.  How do I do this if possible?
1 Solution
Place the following in your htaccess file

php_value error_reporting 2047

This will set your error reporting to E_ALL. You can also do this per-script using <? error_reporting("E_ALL"); ?>

The htaccess options are not available to PHP-as-CGI users, so be mindful of that limitation as well - I was stuck on that one for a while.
Well, what DrNikon224 suggest is not the only what you have to do.
I guess that hoster also set "display_errors = off"
So your .htaccess has to be like this:
php_value error_reporting 2047
php_flag display_errors 1

Or you can set it inn the begining of your scripts
ini_set('error_reporting', '2047');
ini_set('display_errors', '1');
edsanzAuthor Commented:
how to I declare the other answer as "Assisted Answer" ??  After accepting the first one, I don't see an option to accept the second answer.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now