Hi,

I need to set display_errors to on through htaccess. I cannot do it directly in the php.ini file since I am working on a shared server. Is it possible to do that with the ini_set() function and if so how?

Thanx.

Scott

    you can use this to turn off the error reporting...

    error_reporting(0);

      Originally posted by mhalloran
      you can use this to turn off the error reporting...

      error_reporting(0);

      Hi mhalloran,

      Thanx for answering. In my tiredness I made the mistake of saying I need display_errors off. Actually I need this directive on. My problem is, I can't see any errors, I'm only getting a white page. This naturally makes trouble shooting impossible.

      I have also learned that there is the php_flag and php_value options which I could use in the htaccess file. However, they both don't seem to work.

      php_flag display_errors on
      php_value error_reporting E_ALL

      Could be the permissions set up for my directory in Apache aren't allowing such overrides. Anyhow, if somebody else might have a trick, I would greatly appreciate it.

      Scott

        well if you cant change the php.ini just have error_reporting(E_ALL);

        else you can change the php.ini to that..

          If the script has a parse error then setting error_reporting(E_ALL) in the script will not work. I need to set the directives before the script is parsed and that will only work through htaccess.

          Scott

            I'm not sure if I'm right or not. However ini_set() is used to change the parameters in the php script. The htaccess is a file that the server use. Therefore you probably have to redirect the page in your .htaccess file.

            I don't think the php script has anything to do with your problem and that might be the reason ini_set() does not work. (Note, I not 100% sure).

            I used the following link to get some tips when I worked with my .htaccess file.

            http://web-wise-wizard.com/perl-scripts-cgi-apache-tutorials/apache-httpd-access-files-tutorial.html

            I'm not sure if this helps, but I guess it is worth a try.

            Good luck.

            Kj.

              Hi all,

              Thanx all for your help but I finally found the answer.

              To override php.ini settings through a htaccess file you need to use the following syntax:

              php_value display_errors "On"
              php_value error_reporting "63"

              This example will show errors on a server where display_errors is turned off. Of course the Apache server must be set up to allow overriding through htaccess in your web site directory.

              There is also the php_flag command. This should also work for the directives which only have a On/Off value. i.e.

              php_flag display_errors "On"

              Hope this will help others in the future.

              Scott

                Write a Reply...