How to Fix No Such Host Is Known Error in Php
Wondering how to disable the above error? Even if you set in your php.ini: display_errors = Off Errors will still pop out. Solution:...
https://www.czetsuyatech.com/2021/07/php-no-such-host-is-known.html
Wondering how to disable the above error?
Even if you set in your php.ini:
display_errors = Off
Errors will still pop out.
Solution:
Just add @ at the beginning of the function:
@, suppress the warnings produced
Php documentation says:
[phpdoc]
Error Control Operators
PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.
If the track_errors feature is enabled, any error message generated by the expression will be saved in the variable $php_errormsg. This variable will be overwritten on each error, so check early if you want to use it.
[/phpdoc]
Even if you set in your php.ini:
display_errors = Off
Errors will still pop out.
Solution:
Just add @ at the beginning of the function:
$handle = @fopen($obj, "r");
@, suppress the warnings produced
Php documentation says:
[phpdoc]
Error Control Operators
PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.
If the track_errors feature is enabled, any error message generated by the expression will be saved in the variable $php_errormsg. This variable will be overwritten on each error, so check early if you want to use it.
[/phpdoc]
2 comments
It just silent the error it doesn't fix it.
Yes, that's why I said "how to disable the error", not fix :-)
Post a Comment