Page 1 of 1

Cannot turn error messaging on

Posted: Thu Jan 11, 2007 9:25 pm
by SoreE yes
I had someone write a php script for me, but it kept coming up with an error, so he turned errors off. Great. Like if there is a warning light indicating some problem, turn off the light. Problem solved. Anyway I can't turn it back on. I don't know what he did to turn it off. I've tried changing the error messaging in php.ini (both in the current directory and in the oringal php directory). I've also tried turning it on in the page script, but to no avail. What next?

Posted: Thu Jan 11, 2007 9:30 pm
by neophyte
Post the directives you put in the php.ini, htaccess files, and the original php file itself ...

Posted: Thu Jan 11, 2007 9:31 pm
by feyd
Asking the person what they did?

There are two things to look for: error_reporting and display_errors

Look for both in php.ini, .htaccess files (including parent directories) and within your scripts.

Step 2, shoot the person that wrote it. :D

Posted: Thu Jan 11, 2007 9:35 pm
by volka
and search for @

Code: Select all

// no warnings when $r is not a valid resource
@mysql_fetch_array($r) 

// supresses _all_ warnings when executing yadda.php
@include 'yadda.php';

Shoot the person who wrote it

Posted: Fri Jan 12, 2007 12:23 am
by SoreE yes
feyd wrote:Step 2, shoot the person that wrote it. :D
What a good idea. I am based in Thailand at the moment and guns are plentiful. People shoot each other regularly, even over things trivial. One can get someone shot for as little as $100. But I think I'll let him off this time.

Code included

Posted: Fri Jan 12, 2007 12:34 am
by SoreE yes
In the php.ini file, the active error directives are

Code: Select all

error_reporting  =  E_ALL & ~E_NOTICE
display_errors = On
display_startup_errors = on
track_errors = On
html_errors = On
The htaccess files are new to me. I searched on all files on my hard disc and all the htaccess files were not accessible and had not been modified for a number of years.

All of my php scripts are affected.

Posted: Fri Jan 12, 2007 1:47 am
by feyd
Do you recall what errors you were getting?

Errors forgotten

Posted: Fri Jan 12, 2007 2:19 am
by SoreE yes
I only briefly saw the errors that came up, before this chap made changes and don't remember what they were. I have just managed to speak to him on the phone. It's difficult because he is Thai with little English and I speak English knowing even less Thai. And at best he can be described as a 'man of few words'. But from the broken converstion it appears that he did change something in the php.ini file.

I have just noticed that in the phpMyAdmin, from the php information, where it shows the configuration settings for php Core, that display errors is turned off, both local and master. Does this indicate the present settings on my machine, or is it a reference guide?

Posted: Fri Jan 12, 2007 4:02 am
by Kieran Huggins
Check all the way at the bottom of the php.ini - it's possible he's overriding the above values down there.

Also double check that there's no auto_prepend_file set - he might be setting a few things in there as well.

Posted: Fri Jan 12, 2007 5:02 am
by SoreE yes
Kieran Huggins wrote:Check all the way at the bottom of the php.ini - it's possible he's overriding the above values down there.

Also double check that there's no auto_prepend_file set - he might be setting a few things in there as well.
.

Thanks Kieran. Done that and nothing seems out of place.

Posted: Fri Jan 12, 2007 5:22 am
by Kieran Huggins
Is it logging errors to a file? Look for errors.txt or something similar.

If you can't find one, paste this and run it alone:

Code: Select all

lets_debug($this_damn_problem){
   this is soooo totally invalid!
}

Posted: Fri Jan 12, 2007 9:50 am
by feyd
Run the following in a new file please. You don't need to show us the results, but you can use it to compare where your edited php.ini is and where php is reading it from. It will also tell you where your errors are being reported to.

Code: Select all

<?php

$eol = (php_sapi_name() == 'cli' ? "\n" : "<br />\n");
echo 'Config path: ', get_cfg_var('cfg_file_path'), $eol;
echo 'Error log: ', get_cfg_var('error_log'), $eol;

?>
After confirming you are editing the correct php.ini, you can set error_reporting to E_ALL.

Posted: Fri Jan 12, 2007 12:32 pm
by volka
and while you're at it you can also set

Code: Select all

disable_functions = error_reporting,ini_set
If one of these functions is called in the script you will get a warning: function 'xyz' is disabled for security reasons on line N in path/to/file. Just in case the report level is changed within the script.
see http://de3.php.net/manual/en/features.s ... -functions

It worked.

Posted: Fri Jan 12, 2007 9:13 pm
by SoreE yes
It worked. Thanks. When I ran the script to show the location of the configuration file it came up with

Code: Select all

C:\WINDOWS\php.ini
I had been looking on the web for a script that might tell me the present configuration settings, or the location of the used configuration file, but could not find anything, so thanks for supplying one.
This little creature in the windows directory had eluded me and I still don't know why. I had performed a search on the hard drive for any file called 'php.ini' and only ones in the /php directory, the root directory and the more local directories came up in the search results. The one in the windows directory did not show. All the files look identical so I am baffled. Anyway, I'm happy and can now get on with some work.

Posted: Sat Jan 13, 2007 9:32 pm
by Ambush Commander
The location of the ini file often baffles Windows users. The most efficient way to figure out where the ini file is is to call phpinfo() and look for the ini file string. Glad to see you found the problem.