PROBLEM: Error dump messages are truncated to 5 characters only.
In the following example it is 'Canno'
[07-Nov-2022 23:42:06 Europe/Berlin] PHP Fatal error: Canno in /httpdocs/includes/Database.php on line 570
[07-Nov-2022 23:42:06 Europe/Berlin] PHP Stack trace:
[07-Nov-2022 23:42:06 Europe/Berlin] PHP 1. {main}() /httpdocs/home.php:0
[07-Nov-2022 23:42:06 Europe/Berlin] PHP 2. require_once() /httpdocs/home.php:4
[07-Nov-2022 23:42:06 Europe/Berlin] PHP 3. require_once() /httpdocs/includes/master.inc.php:61
P.S. the question is NOT about the PHP error, but about the SIZE of the error message itself. In some cases it is 3 chars only in others - 5.
No more, no less.
Yes, it happened on
client's server
local machine, Apache, php 5.6.
Yes, I immediately checked the php.ini settings for log-errors-max-len or any other trace of incnsistency, but found no problems at all.
An idiot programmer put a ini_set("log_errors_max_len", 3); message in one of major include files....somewhere in the middle of the file....and ini_set("log_errors_max_len", 5); in another.
I found it, when explicitly started to eliminate gazillion of includes. And in some cases received 3char messages , while some others gave 5 chars.
Related
I cannot seem to locate the source of this issue. I actually have nearly the same Docker container and Exception handler lib running in another app. However, for some reason, I'm getting duplicate log entries in the error log file.
The issue is that it's not just duplicate entries that are the same (that'd be another interesting issue). It's the same Exception being logged and the same stack trace, but one is from my custom Exception handler (JSON), and the other is the default PHP error log handler (or so it seems - tested with CLI SAPI as well as PHP-FPM).
I was under the assumption that PHP wouldn't write to the log file if an exception handler was set. I'm also executing die(1) at the end of the callback function for the Exception handler.
Again, all of the Exception handling code seems to be working well. It's just that PHP is still logging the Exception. Is there a setting or something else that I'm missing here needing to be done on the PHP config side?
Below is a copy of the error log output:
[24-Nov-2018 02:20:11 UTC] PHP Exception: Testing in /srv/www/boot/common.php on line 65
[24-Nov-2018 02:20:11 UTC] PHP Stack trace:
[24-Nov-2018 02:20:11 UTC] PHP 1. {main}() /srv/www/public/index.php:0
[24-Nov-2018 02:20:11 UTC] PHP 2. require() /srv/www/public/index.php:13
{"timestamp":"2018-11-24 02:20:11 UTC","level":"critical","message":"Testing","app_version":{},"environment":"dev","class":"Exception","file":"\/srv\/www\/boot\/common.php","line":65,"code":0,"previous":null,"trace":[{"file":"\/srv\/www\/public\/index.php","line":13,"function":"require"}],"user":[],"tags":[],"extra":[],"output_buffers":[]}
Going to leave this here for anyone that might come across this. The issue turned out to be XDebug which hijacks your Exceptions. It was enabled on this particular app in our dev env.
I'm searching for a list will all possible PHP error messages. Google couldn't help me out this time.
Example:
Fatal error: Call to undefined function ... in ... on line ...
Warning: require_once(...) [function.require-once]: failed to open stream: No such file or directory in ... on line ...
Warning: Illegal offset type in ... on line ...
and much more of such erros...
According to the php.net http://php.net/manual/en/tokens.php PHP is using tokens to generate error messages. But i still don't understand how to use them to generate an error message like
Fatal error: Call to undefined function T_SOME_TOKEN in T_SOME_TOKEN on line 666
Where should i search for such an error generator? I assume that it is hidden somewhere in PHP's source code, but i have no idea where to start.
The purpose is to build an PHP error parser which would monitor server error messages (if they are enabled) and check for PHP script updates:
Script "foo.php" which returns multiple errors
Scan 1 (time t1):
PHP Error on line 1000
PHP Error on line 1200
Scan 2 (time t2):
PHP Error on line 1010
PHP Error on line 1210
1010 - 1000 = 10 lines of code were added (somewhere between lines 0 and 1010). By using this approach and knowledge of which bug was fixed at which time it is possible to make kind of "PHP error based black box reverse engineering" of a given PHP script (if there are enough other reproducible PHP bugs in such script) (e.g. buggy game engine).
I recently installed xdebug, and now stack traces are printed to my apache error.log:
PHP Fatal error: Call to a member function get_upload() on null in /var/www/html/template/user/post-single.php on line 10
PHP Stack trace:
PHP 1. {main}() /var/www/html/index.php:0
PHP 2. include() /var/www/html/index.php:19
I dont like them, as they clutter my log, and if i need them i will get them from my debugging client. Is there any way i can disable them?
EDIT: To be clear, i do not want to disable Xdebug, I just want it to not print the stack traces.
I have recently started encountering issues when trying to access my hosted phpMyAdmin. I am getting a 500 inernal server error when trying to access it and as expected getting nothing but a blank page in my browser.
I have had a look at the error log for phpMyAdmin and noticed the following error is being raised:
PHP Fatal error: Call to undefined function PMA_sanitize() in /usr/share/phpMyAdmin/libraries/Message.class.php on line 541
Firstly, I reinstalled phpMyAdmin and after this, was able to access it fine for a while before I began experiencing the same issue again.
I had a look around the web and came across the following blog here with a potential fix for this problem. I did what the blog suggested and added the following:
require_once('./libraries/sanitizing.lib.php');
at the top of the following file:
/usr/share/phpMyAdmin/libraries/Message.class.php
this worked for a while but then got another 500 internal server error. So again I checked the error log and got the following error message:
PHP Fatal error: Cannot redeclare PMA_checkLink() (previously declared in /usr/share/phpMyAdmin/libraries/sanitizing.lib.php:15) in /usr/share/phpMyAdmin/libraries/sanitizing.lib.php on line 35
As well as these fatal errors I am getting the following warning messages but not sure if these have anything to do with the issue:
PHP Warning: Unknown: Unable to allocate memory for pool. in Unknown on line 0
PHP Warning: require_once(): Unable to allocate memory for pool. in /usr/share/phpMyAdmin/index.php on line 13
PHP Warning: require(): Unable to allocate memory for pool. in /usr/share/phpMyAdmin/libraries/common.inc.php on line 52
PHP Warning: require_once(): Unable to allocate memory for pool. in /usr/share/phpMyAdmin/libraries/Error_Handler.class.php on line 12
PHP Warning: require_once(): Unable to allocate memory for pool. in /usr/share/phpMyAdmin/libraries/Error.class.php on line 12
I am running a dedicated Centos 6 server with PHP version 5.3.3, Apache version 2.2.15, mysql version 5.1.61 & phpMyAdmin version 3.5.7
If anyone can shed some light on this, that would be excellent!
require_once(): Unable to allocate memory for pool. means there was not enough memory to include some of the declaration files from PhpMyAdmin.
These files having not been included, the definitions they contain were not loaded. Hence your first errors Call to undefined function PMA_sanitize().
The blog post you linked to advises adding an inclusion at a dubious location, leading you to include some definition files where it shouldn't. Hence your second error Cannot redeclare PMA_checkLink().
If I were you I would rollback all changes in the PhpMyAdmin code and try to address the first problem. This question will probably provide you with the right procedure.
I am trying to run some client code to call a server side API.
I put various put statements to see where the code crashes and the line crashing it is
$tagXml = new SimpleXMLElement($tags);
(where tags is the result of a file_get_contents call)
I downloaded php5 and I am running it from the php source file from the command line.
Why is this crashing the code.
Perhaps there is an addon for php I need to add to use new SimpleXMLElement($param)
edit I got error reporting working
Warning: simplexml_load_file(): I/O warning : failed to load external entity "https://api.domain/v2/andy/tags" in C:\java\domain-api-v2\simple\list-
tags.php on line 30
working line 30
Fatal error: Uncaught exception 'Exception' with message 'String could not be pa
rsed as XML' in C:\java\domain-api-v2\simple\list-tags.php:37
Stack trace:
0 C:\java\domain-api-v2\simple\list-tags.php(37): SimpleXMLElement->__const
ruct('')
1 {main}
thrown in C:\java\domain-api-v2\simple\list-tags.php on line 37
I would check your error log. There are two immediate possibilities:
You are not including the SimpleXMLElement class in the file that you are running
$tags is some kind of format that SimpleXMLElement doesn't like.
If you check your error log (and have error reporting turned on) then you should see whats going on.
I was experienced this problem before. How much size of $tags contents ?
You have to use simplexml_load_file() instead of file_get_contents() , if file's size are bigger and server performance is low.