If you are here because:
(1) when you try to run Joomla 1.5.x, 1.6.x, or 1.7.x under XAMPP 1.7.4 or 1.7.7 you get lots of errors like Strict Standards: Accessing static property JCache … or
(2) you are running a popular PHP application and gettings errors when installing or running it out-of-the-box
then see this page instead.
NOT RECOMMENDED: One of the reasons for installing XAMPP is to be able to detect errors in your site and code. Disabling error reporting makes this a lot harder.
These instructions are for XAMPP version 1.7.3, but it should work for other versions as well.
If you are getting errors, the CORRECT thing to do is to FIX those errors, not hide them by turning off ‘display_errors’. Those errors are still there whether the setting is on or off.
Think of it this way, smoke detectors detect smoke from fires. If you have a fire in the house and the smoke detector goes off, pulling out the battery to silence the smoke detector does not fix the problem with the fire.
One of the default settings when XAMPP is installed is to display PHP errors when they occur. This is useful for debugging, but downright dangerous for a production environment.
Usually, you won’t notice this setting – unless you happen to be installing Joomla! under XAMPP, then it will warn you that the Display Errors setting is set to On when the recommended setting is Off. (Click for larger image)
\
This isn’t a problem. However, if you want to turn off the warning then do the following:
(1) Go to the php directory under XAMPP. Normally, this would be C:\XAMPP\php, but you may have installed it to a different drive or directory (mine is installed on my D: drive). Locate the file named php.ini . Open this file using a plain text editor – like notepad. Using a word processor (like Word) will very likely seriously corrupt the file. (I use an application called Notepad++). Note: The icon associated with php.ini will depend on what application is associated with .ini files.
(2a) Find the line display_errors = On
. In the XAMPP 1.7.3 install, this is line 531.
(2b) Change the On to Off.
(2c) Save the file.
(3) Restart the Apache server. The easiest way is to open the XAMPP control panel and click on the Stop button. Then click on Start to restart it. (You could also reboot the computer, but that is not necessary.)
These instructions do not work.
I am sorry to hear you had problems, but this is the only way to change the behaviour of the php processor (aside from modifying the source code and compiling your own version).
Troubleshooting over the Internet without access to your computer and without knowing how everything is set up, I can only offer the following troubleshooting tips:
1) are you using XAMPP 1.7.3 on Windows XP with Service Pack 3 (are you using a different version of XAMPP? Are you running on a different version of Windows?)
2) do you have multiple XAMPP installs? Only one XAMPP install can be active at a time, so editing the php.ini information in the inactive install will not affect anything.
3) did you save the php.ini file after editing it?
4) did you edit the correct line in the php.ini file?
5) did you edit the correct php.ini file?
6) did you restart the Apache server? The guaranteed way to restart the server is to restart the computer (not Hibernate or Sleep, but Restart).
7) Did you restart your browser session? You at least need to refresh the Joomla! page on which you were seeing the warning message.
8) Is XAMPP providing your web services or do you have some other server – for, example IIS?
I’m currently on holiday, so my ability to offer more detailed troubleshooting help is limited until I get back, but the likely cause is some small oversight.
Its working…thnx…brother…
You’re welcome.
Thank you admin you help me solve the problem. thankx
to: marc hill they did not work for you because you do not read.
is pretty simple, hey i guess you need to understand how php language work. is simple yet so complex for people in a hurry. Read and you will find the answers. but if is easier for you i’l email you the php.ini
file and you compare it side by side.or use it and continue without knowing. hint “your not changing the settings at the right place”
Thank you for the positive feedback.
thanx dear………..its working….
You’re very welcome.
Nice, it worked… :DD
For suppressing Notice Errors you can set
error_reporting = E_ALL & ~E_NOTICE
in php.ini file under “\xampp\php” folder.
Similarly you can do other settings for which explanation is given as under…
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; This directive informs PHP of which errors, warnings and notices you would like
; it to take action for. The recommended way of setting values for this
; directive is through the use of the error level constants and bitwise
; operators. The error level constants are below here for convenience as well as
; some common settings and their meanings.
; By default, PHP is set to take action on all errors, notices and warnings EXCEPT
; those related to E_NOTICE and E_STRICT, which together cover best practices and
; recommended coding standards in PHP. For performance reasons, this is the
; recommend error reporting setting. Your production server shouldn’t be wasting
; resources complaining about best practices and coding standards. That’s what
; development servers and development settings are for.
; Note: The php.ini-development file has this setting as E_ALL | E_STRICT. This
; means it pretty much reports everything which is exactly what you want during
; development and early testing.
;
; Error Level Constants:
; E_ALL – All errors and warnings (includes E_STRICT as of PHP 6.0.0)
; E_ERROR – fatal run-time errors
; E_RECOVERABLE_ERROR – almost fatal run-time errors
; E_WARNING – run-time warnings (non-fatal errors)
; E_PARSE – compile-time parse errors
; E_NOTICE – run-time notices (these are warnings which often result
; from a bug in your code, but it’s possible that it was
; intentional (e.g., using an uninitialized variable and
; relying on the fact it’s automatically initialized to an
; empty string)
; E_STRICT – run-time notices, enable to have PHP suggest changes
; to your code which will ensure the best interoperability
; and forward compatibility of your code
; E_CORE_ERROR – fatal errors that occur during PHP’s initial startup
; E_CORE_WARNING – warnings (non-fatal errors) that occur during PHP’s
; initial startup
; E_COMPILE_ERROR – fatal compile-time errors
; E_COMPILE_WARNING – compile-time warnings (non-fatal errors)
; E_USER_ERROR – user-generated error message
; E_USER_WARNING – user-generated warning message
; E_USER_NOTICE – user-generated notice message
; E_DEPRECATED – warn about code that will not work in future versions
; of PHP
; E_USER_DEPRECATED – user-generated deprecation warnings
;
; Common Values:
; E_ALL & ~E_NOTICE (Show all errors, except for notices and coding standards warnings.)
; E_ALL & ~E_NOTICE | E_STRICT (Show all errors, except for notices)
; E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR (Show only errors)
; E_ALL | E_STRICT (Show all errors, warnings and notices including coding standards.)
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
; http://php.net/error-reporting
;error_reporting = E_ALL | E_STRICT
Thanks for your comment, but what you are doing is something different.
The flag
display_errors
instructs PHP to display or not display any errors encountered.This tutorial is to turn that off. I wrote it because some people get freaked out when they see the
Display Errors
setting in a Joomla! install set to (a red)On
when the recommendation is (a green)off
The technique you are using changes the level of error reporting that PHP does, but it does not turn of display errors.
display_errors = Off but still not working..what else i must do?
help me 🙁
What is not working?
I am going to guess that you are trying to install Joomla! under XAMPP 1.7.4 or XAMPP 1.7.7 – if that is the case, then I recommend changing to XAMPP 1.7.3 (actually, I recommend it for whatever you are using) .
The only reason you would need to use XAMPP 1.7.4 or 1.7.7 is because you absolutely need to use: PHP 5.3.5 or PHP 5.3.8 and Perl 5.10.1. In most cases, this is not necessary.
If you insist on using them, then find the flag error_reporting and change it to look as follows:
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED
Joomla! uses a lot of deprecated PHP code and XAMPP 1.7.4 and 1.7.7 are configured to choke on it. By disabling the NOTICE and DEPRECATED flags, the PHP interpreter will let them pass.
Another reason it may not be working is that there are errors in the code. Turning off the display of errors does not make them go away.
Thank you!!!!!
You’re welcome and thanks for the feedback.
Drop the preaching on importance of error messages. M
Most people who want this turned off wont fix any bugs anyway.
I just want to run the site locally, modify what I need to modify, see that it runs and upload it to production. I could care less about some php warnings as long as the thing runs without exploding the server, it’s “good enough”.
I agree, however, I can’t please everyone with every article.
Developers need to understand that the proper way to deal with errors is to fix them, not hide or ignore them.
For the average user, they expect their software to work – they don’t want to have to twiddle and fiddle with it.
Following the paths to this article, it seems most people come here because they are experiencing problems with XAMPP 1.7.4 or 1.7.7 and Joomla! – which this tip won’t fix. The proper way to deal with their problem is to change the flag controlling error reporting in PHP to not flag deprecated constructs as errors.
This article was originally written to placate those people who freaked out when they saw the Display_Errors was set to ON when Joomla! recommended OFF.
Thanks for your comment.
Thank You
Thanks for the feedback!
Thank you so much, very helping material.
You’re welcome and thanks for letting me know.
There is a very useful list of PHP standards we should use in development. This list can be found at
the web address below.
http://phphelp.co/2012/06/04/what-are-some-common-php-coding-standards/
It is more of a check list of things, I would say.