472,378 Members | 1,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

is there anyway to hide php error messages ?

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.
Dec 10 '09 #1
14 5044
Dheeraj Joshi
1,123 Expert 1GB
Are you doing this in your code?

Expand|Select|Wrap|Line Numbers
  1. ini_set("display_errors", 1); 
  2.  
Regards
Dheeraj Joshi
Dec 10 '09 #2
Thanks Mr Dheeraj Joshi , you helped me alot, it's solved, it was great really ,
Dec 10 '09 #3
Dormilich
8,658 Expert Mod 8TB
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.
Dec 10 '09 #4
Dheeraj Joshi
1,123 Expert 1GB
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 Joshi
Dec 10 '09 #5
Thanks Guys for replies

i fixed the error but i'm still putting ini_set("display_errors", 1);
in my code just to protect hosting path for any error , is this can make any problem ?
Dec 10 '09 #6
Dormilich
8,658 Expert Mod 8TB
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_handler()

* - I’d always prefer Exceptions over User Defined Errors
Dec 10 '09 #7
Thanks Mr Dormilich, your reply was useful
Dec 10 '09 #8
kovik
1,044 Expert 1GB
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_reporting" 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).
Dec 11 '09 #9
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 ?
Dec 11 '09 #10
Dormilich
8,658 Expert Mod 8TB
just you and hosting. though a decent error catching system can react immediately (e.g. sending a mail), while you have to access the error.log yourself.
Dec 11 '09 #11
kovik
1,044 Expert 1GB
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. :P
Dec 11 '09 #12
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 ?
Dec 11 '09 #13
kovik
1,044 Expert 1GB
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.
Dec 11 '09 #14
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 hosting
Dec 13 '09 #15

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: lkrubner | last post by:
This is a general computer question, but I'm writing in PHP so I'll post this to comp.lang.php. I've been writing a content management system. I've a Singleton object that keeps track of all...
1
by: Galina | last post by:
Hello I have created a trigger not to let records with certain fields null to be inserted into the table: BEGIN IF :new.RUL_CODE is null or :new.FES_UINS_CODE is null or :new.FES_UIO_CALOCC is...
10
by: DataBard007 | last post by:
Hello Access Gurus: I use Win98SE and Access97. I just built a simple Access97 application which holds all contact information for my personal contacts, such as first name, last name, address,...
10
by: Brian Conway | last post by:
I have no idea what is going on. I have a Login screen where someone types in their login information and this populates a datagrid based off of the login. Works great in debug and test through...
5
by: tlyczko | last post by:
Hello, I've searched on toggling divs and didn't really find what I was looking for, I saved a bunch of different threads. I have a form with several different text boxes for things like dates,...
4
by: mac | last post by:
Brand Newbie Alert! I am working through the "Build a Program Now!" book by Microsoft Press. The last chapter has a little app that should stay in the system tray when the user clicks on the 'X'...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
3
by: Paul McGuire | last post by:
Is there any way to hide portions of an exception stack trace? When users get exceptions when using pyparsing, there are usually many layers of pyparsing-internal stack messages that are not at...
2
by: FutureShock | last post by:
I am using a registration class to process a registration form and need some opinions on returning error messages. I am self referring the page on submit. I would like to send each form field...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.