Is there anyway to hide php error messages? Because i have in my php code error but it redirecting after 1 sec and shows my hosting path and php error number, but this error doesn't effect anything.
is there anyway to hide php error messages ?
Collapse
X
-
is there anyway to hide php error messages ?
-
-
-
it is always better to fix any errors that occur. as already mentioned, you can suppress the display of error messages, but this will get you in trouble, if there is a critical error appearing. additionally, you can catch any ‘error’ below E_ERROR level (i.e. warnings, notices and user defined errors) yourself and preventing them to show up.Comment
-
I will go with Dormlich's suggestion.
Its always good to fix all errors and warning in the code... You just can't predict that the error throwing situation can not occur..... Anyways try to fix the bug.
Regards
Dheeraj JoshiComment
-
Thanks Guys for replies
i fixed the error but i'm still putting ini_set("displa y_errors", 1);
in my code just to protect hosting path for any error , is this can make any problem ?Comment
-
of course, you won’t notice any new errors unless you catch the errors (as possible) beforehand. see also Exceptions*, Error Handling and set_error_handl er()
* - I’d always prefer Exceptions over User Defined ErrorsComment
-
-
ini_set() is a function that alters the settings of your php.ini file for the rest of your script. php.ini is a file that is read and parsed by your server. As such, your server receives all errors from PHP that php.ini sets. This is governed by the "error_reportin g" flags, not the "display_errors " flag.
In other words, even if you don't display the errors, the errors are still saved. In Apache, the error messages are in the apache/logs/errors.log file, in the order in which the occurred (ascending IIRC).Comment
-
Hi Mr Kovik , Thanks for replay
i was asking for code just to hide the error messages from users because that can show my hosting path
but is the file logs/errors.log can be accessed by anyone else or just me and hosting ?Comment
-
Well, depending on the capability of your host, it's possible that they are the only ones with access. Servers are capable of creating one central errors.log for the entire shared server, or for developing individual errors.log files for each sect.
When looking for a good host, this is normally one of the things that I check. I also check for proper PHP settings (i.e. magic_quotes), flexible database table naming (i.e. no automatic prefix), and that they have the newest versions of Apache, PHP, and MySQL installed. Normally, a lack of any of these attributes implies that the server is run by amateurs who are more concerned about themselves than their users.
But, I digress. :PComment
-
Thanks to Mr Dormilich and Mr Kovik for replies
is there a way to check if the hosting is using central or individual errors.log ?Comment
-
If you have FTP access (which you *should*), then look in the file structure. There's a folder that is your root folder, where your main index page should exist. If you have access to the folder above your root folder, there is likely a "logs" folder in which you will find your errors.log file.
If not, then look through all of the folders in your root folder that you did not explicitly create. If you do happen to find your errors.log file in one of these folders, I suggest that you use a .htaccess file to block access to that folder (unless the server already blocks it). Otherwise, it may be open to the public eye.Comment
-
Thanks Dear Kovik
but i logged in FTP but i just see all my folders and there's no other folders or files
i'm using godaddy hostingComment
Comment