Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do PHP error messages contain a link to the name of the name of the function in their HTML representation?

Tags:

php

Why do PHP error messages contain a link, such as this error:

<b>Warning</b>: preg_match_all() [<a href='function.preg-match-all'>function.preg-match-all</a>]: Delimiter must not be alphanumeric or backslash in <b>/home/www/test.php</b> on line <b>93</b><br />

with this link?:

[<a href='function.preg-match-all'>function.preg-match-all</a>]

Is the assumption that PHP will be configured to put a http://www.php.net/ in front of that URL? Or that a person will have a copy of the PHP documentation on their web server and that by clicking on that link they will be able to access information about the function?

This is just something I've been curious about since it seems that unless the error occurred on php.net, such a link would be useless.

I know it's possible to set up custom error handlers, etc. My question is: Why is this the default behavior of PHP?

Thanks.

like image 605
chaimp Avatar asked Dec 29 '10 21:12

chaimp


People also ask

What is PHP error message?

A PHP Error occurs when something is wrong in the PHP code. The error can be as simple as a missing semicolon, or as complex as calling an incorrect variable. To efficiently resolve a PHP issue in a script, you must understand what kind of problem is occurring.

How can I send error message from PHP to HTML?

By default, PHP sends an error log to the server's logging system or a file, depending on how the error_log configuration is set in the php. ini file. By using the error_log() function you can send error logs to a specified file or a remote destination.


2 Answers

You are able to set docref_root to prepend the URI. it is intended to be used with a local copy of the manual but can used with an external one.

To turn off html errors altogether, set html_errors to 0.

like image 178
webbiedave Avatar answered Oct 21 '22 03:10

webbiedave


It's indeed supposed to link to php.net, but most default configurations have it turned off. And you are supposed to redirect it to a local manual copy. (Mine has /phpmanual/, where the php-manual package would probably put it; and I believe the package manager would uncomment the option then.)

The option docref_root in php.ini can be used to set it.

like image 27
mario Avatar answered Oct 21 '22 02:10

mario