how can i fix use of undefined constant in php.ini

so that constant and "constant" should not gives me any error

Recommended Answers

All 6 Replies

how can i fix use of undefined constant in php.ini

so that constant and "constant" should not gives me any error

nothing is clear with this, exactly what you want to do

i am trying to develop a site.............when i referesh page it gives me the follwoing error
Use of undefined constant admin_mail - assumed 'admin_mail'

i am hosting my site on my home server so i want to set my php.ini so that i didn't get the above error

i am trying to develop a site.............when i referesh page it gives me the follwoing error
Use of undefined constant admin_mail - assumed 'admin_mail'

i am hosting my site on my home server so i want to set my php.ini so that i didn't get the above error

It may be the case that you unknowingly deleted the '$' in front of the variable 'admin_mail'.
search for it in your script

Hey.

Yea, you typically get this warning if you leave out the $, as network18 suggested, or when you forget the quotes around a string.
In either case, PHP will assume it is a string who's quotes got left out and use it as such.

Ideally you should hunt the bug down and fix it, but if for some reason you just want to hide it, you can add this to the top of your page:

ini_set('display_errors', false);
error_reporting(0);

Or you can hunt down either of those directives in your php.ini file and set them there. (Note, that will affect all PHP scripts on your server!)

hey Atli, thanks for carrying forward the idea.
But personally i recommend of clearing this type of syntactical errors at the very moment and disagree with turning the error reporting off, because I feel at the learning stage the person should learn to deal with all such types of errors and warning message .
Going one step ahead, i recommend not to avoid the warnings also.

hey Atli, thanks for carrying forward the idea.
But personally i recommend of clearing this type of syntactical errors at the very moment and disagree with turning the error reporting off, because I feel at the learning stage the person should learn to deal with all such types of errors and warning message .
Going one step ahead, i recommend not to avoid the warnings also.

Agreed. Like I say, ideally these sort of bugs should be hunted down and fixed, even though the code may function without it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.