Re: logging erros and user access to logs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
> Get the errors OFF the web page (display_errors OFF) and into the logs
> and provide your users with logs for their own domains with vhosts.
> 
> On Wed, March 14, 2007 11:02 am, Jason Joines wrote:
>>     My users want to be able to debug their scripts, see mysql errors,
>> and such.  Using mysql_error(), and display_errors, problems such as
>> non-existent databases, or variable and such seem to get printed to
>> the
>> screen.  However, syntax errors do not.  They get written to the
>> global
>> php log, for example, "PHP Parse error:  parse error, unexpected
>> T_ECHO,
>> expecting ',' or ';'" when a semi-colon is missing.  I can't just give
>> all system users access to the global log.
>>
>>     I saw an example at
>> http://www.php.net/manual/en/ref.errorfunc.php#ini.display-errors that
>> seemed to suggest including the script to debug in something like this
>> demodebug.php script would do the trick:
>>
>> <?php
>> error_reporting(E_PARSE);
>> ini_set('display_errors','On');
>> ini_set('display_startup_errors','On');
>> include('demo.php');
>> ?>
>>
>> When I remove a semi-colon from demo.php and load demodebug.php in the
>> browser, nothing is displayed on the screen.  The error still goes to
>> the global log.
>>
>>     I'm running PHP 4.3 on Apache 2.  I have these settings in my
>> php.ini:
>>
>> error_reporting  =  E_ALL & ~E_NOTICE
>> display_errors = Off
>> display_startup_errors = Off
>>
>> I thought the above debugdemo.php script was basically supposed to do
>> a
>> local override so that script could display the errors.
>>
>>     Is there any good way to let users see all the errors from their
>> scripts.
>>
>>
>> Jason Joines
>> =================================
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> 
> 


    Unfortunately, the separate logs for separate virtual hosts doesn't
work for this situation.  It is a college web server with about 300
users and 20 departments, each with their own site in the same virtual
host and many thousand pages.

    I need to be able to have users turn on error display while
creating/debugging their script and then turn it off.  The above
solution from php.net would be ideal.  The suggestion was to use a
script like this, say call it mypagedebug.php, and include the script to
be debugged, say mypage.php, like so:
  <?php
    error_reporting(E_PARSE);
    ini_set('display_errors','On');
    ini_set('display_startup_errors','On');
    include('mypage.php');
  ?>
Then when debugging was done, just delete the debug script.

    I moved it to a test server and could get it to work but only if
display_errors was set to on in the global php.ini file.  I can't do
that on the production server.  The manual says display_errors can be
overridden in a script.  I used ini_get() to see if the value was
actually being changed, it was.  However, it still doesn't print the
errors unless the global ini is set.

    Any ideas as to why it's not working?


Jason
===========

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux