enable PHP errors with htaccess?

Posted on 2006-04-10
Last Modified: 2008-01-16
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?
Question by:edsanz
    LVL 16

    Accepted 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.
    LVL 6

    Expert Comment

    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');

    Author Comment

    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.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    These days socially coordinated efforts have turned into a critical requirement for enterprises.
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now