when i try to connect mysql in Xamp that give me
Strict Standards: Declaration of DBAccessor::connect() should be compatible with that of mysqli::connect() in C:\xampp\htdocs\cgs\CGS\com\DBAccessor.class.php on line 237
database password, host and user were correctly enterd in my code
Is DBAccessor a class you wrote, or a part of some library/application.
If you wrote it, then you should know that when extending a base class (mysqli in this case) methods in extending class should have same signatures as methods in base class.
If you didn't write it: switch off E_STRICT error level
error_reporting(error_reporting() & ~E_STRICT);
Strict standards messages should not be displayed by PHP as they are disabled by default. Please edit your php.ini and change the error_reporting option to:
error_reporting = E_ALL & ~E_NOTICE
It's not related to MySQL credentials but to the way your PHP settings are.
If you do not have access to the php.ini file you can try to edit your htaccess file.
Related
Here are some examples to some of the errors. I heard this is a result of old code in new code, but I can't change my PHP version off the native 5.4 version ispmanager uses because I need Apache. Tried switching version but it messes up my site. Any ideas?
PHP Strict Standards: Redefining already defined constructor for class Object in /var/www/ku/data/www/Public IP/cake/libs/object.php on line 54, referer: http://Public IP/posts/add
PHP Strict Standards: Non-static method Configure::getInstance() should not be called statically in /var/www/ku/data/www/Public IP/cake/bootstrap.php on line 38, referer: http://Public IP/posts/add
PHP Deprecated: Assigning the return value of new by reference is deprecated in /var/www/ku/data/www/Public IP/cake/libs/cake_log.php on line 182, referer: http://Public IP/posts/add```
adding this in your PHP code may solve your problem.
error_reporting(0);
#this will display no errors.
error_reporting(E_ALL ^ E_STRICT);
#this will make it just not strict
Is this what you need?
If you have access to the php.ini, add/change the following to it:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
If you don't have access to the php.ini, and you run via Apache (you can have .htaccess file in root). Add this to .htaccess:
php_value error_reporting 30711
Last option is like mentioned by nikhil.
So, I have been asked by a family friend to take a look at their site. It has just recently turned into a big garbled mess of errors such as;
Strict Standards: Non-static method JLoader::import() should not be called statically in /home/sitename/public_html/libraries/joomla/import.php on line 29
Strict Standards: Non-static method JLoader::register() should not be called statically in /home/sitename/public_html/libraries/loader.php on line 71
Strict Standards: Non-static method JRequest::_cleanArray() should not be called statically in /home/sitename/public_html/libraries/joomla/environment/request.php on line 462
I have been looking elsewhere and I have seen mention of changing error_reporting in configuration.php, I have changed it from
var $error_reporting = '-1';
to
var $error_reporting = '6135';
This removed a lot of the errors that was appearing on the page but there is still plenty that exist. Can anyone help me with clearing up the last lot of errors?
From what I can gather, the site is Joomla 1.5 which I know needs to be updated but if I can just get the errors to 'disappear' whilst I can work on updating the site or getting a new one built that would be great!
Thanks
Add $error_reporting = 22516 if you are using PHP 5.4.x
Add $error_reporting = 22519 if you are using PHP 5.3.x
Add $error_reporting = 6133 if you are using PHP 5.2.x
And if you have php.ini access, find error_reporting and assign E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED
IF doesn't work
in your index.php after define( '_JEXEC', 1 ); add error_reporting(0); if not work, replace with error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); Also, after each change if not work, check the error_reporting value in info page.
OR if you don't want to see any error, contact your host to disable display_errors or if you have access to php.ini then do that yourself.
I am having an issue with my business website, and it keeps giving me the following errors on my website and login:
Strict Standards: Accessing static property JCache::$_handler as non static in /home/doveheal/public_html/libraries/joomla/cache/cache.php on line 422
Also on my website is this error:
Strict Standards: Only variables should be assigned by reference in /home/doveheal/public_html/plugins/content/jw_allvideos/jw_allvideos.php on line 42
I have seen many tutorials on how to fix it via changing the strict standard settings in XAMPP, but this does not apply to me as I do not use XAMPP. Truth be told, I did not create the website (someone else did and it was handed to me), and I am really struggling to figure out how to solve this problem.
Any help would be appreciated!
You will on your localhost (Xampp) have access to the php.ini file. Open it and search for:
error_reporting =
There will be a value after the = which you need to change to:
error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT
Once changed, make sure you restart Apache.
This is however somethign you should flag to the developer of jw_allvideos so they can fix it.
Hope this helps
I (like a lot of others) am seeing Strict Standards errors with PHP 5.4.???.
Strict Standards: Only variables should be passed by reference in /home/xxxxxx/public_html/xxxxxx/init.php on line 64
There must have been a change between 5.3 and 5.4. All the "wisdom" on the Internet seems to be about turning the error messages off. In this case this is a program (1,000's of lines written by someone else) that I am disinclined to try to resolve.
If I turn off the error reporting then the script does not execute.
I am trying to work the issue with the writer of the script.
Is there any other solution? Is there a setting that can be placed in the .htaccess file that will allow "non strict standards"?
You need to go into your php.ini file and assign the following:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
This will allow you to show all warnings except deprecated & non-strict standards.
If you want to fix the error rather than ignore it (recomended):
$uri = explode("/",$_SERVER['REQUEST_URI']);
define("INSTALL_URL" , $protocall.$host_name . str_replace("/".array_pop($uri),"/",$_SERVER['REQUEST_URI']));
I managed to run MongoDB on Codeigniter using Alex Bilbie` library. The operations go well (connection, queries etc. ) but sometimes I get these PHP notices:
Message: Mongo::__construct() [mongo.--construct]: localhost:27017: pool get (0x4bfab20)
Filename: libraries/Mongo_db.php
Line Number: 1274
A PHP Error was encountered
Severity: Notice
Message: Mongo::__construct() [mongo.--construct]: localhost:27017: found in pool (0x4bfab20)
Filename: libraries/Mongo_db.php
Is there a way to get rid of these? or maybe hide them..as they don't seem to mess up my pages in another way than splashing into the user's screen.
EDIT
On a few pages though, I use the JQgrid and when the errors show up they mess up my HTTP response and render some messy data.
The specific notice messages here have been removed in the MongoDB PHP driver 1.2.11 or later (see PHP-431). Upgrading your MongoDB driver to the latest should remove the excessive notice logging.
General notes on proper settings for Code Igniter logging in production still apply...
The E_NOTICE level of error reporting is intended to warn you about possible bugs or typos. It is typically only used as a development setting rather than for production messages.
The default error_reporting setting in PHP4 and PHP5 is actually set to ignore these:
E_ALL & ~E_NOTICE
The Code Igniter index.php has an application environment setting which normally shows all errors for development and suppresses error reporting for testing and production. You should set this appropriately:
define('ENVIRONMENT', 'production');
If you actually want to capture these messages for a production environment you should update the production settings in your index.php so that instead of error_reporting(0) you have:
error_reporting() set to appropriate level of detail
display_errors off
log_errors on
error_log path set
For example, in index.php you could have:
case 'production':
error_reporting(E_ALL);
ini_set('display_errors','Off');
ini_set('log_errors','On');
ini_set('error_log','/var/log/php5.log');
break;
That way the messages/notices will still be saved to the error_log if you want to review them, but they will not be shown to the end user.
Off the top of my head, there are a few things you could do. This is not an answer regarding a fix to the MongoDB error you are receveing, but rather regarding some methods in which you could hide the errors.
a) Use the '#' operator to ignore any error outputs from the method being called in which outputs the errors you are receiving. This would result in you renaming the method call to the following #method_outputting_mongodb_error($foo,$bar);.
b) Turn off error reporting in CodeIgniter. This is not the best method as all other errors will not be outputted.
There is a good link here re: how you can turn off error reporting: http://phpdog.blogspot.fr/2012/02/codeigniter-error-reporting-handling.html
As #Stennie mentions this has been fixed in later versions of the driver: https://jira.mongodb.org/browse/PHP-431
Try and upgrade.
Also this only existed on the Windows driver and only start happening after v1.2.1. I know that because the guy who made that JIRA also tried 1.2.1 on my advice and he didn't get those E_NOTICEs. I remember having the conversation that actually triggered that JIRA now :).
Unlike others I don't think you should "hide" these errors with E_ALL & ~E_NOTICE. No one is quite decided on hiding E_NOTICE however the general concensus is that it is not the best thing. Of course you would not want your logs to be filled with all this debug info about the MongoDB extension, instead the MongoDB extension should be silent (as you think it should).
Another reason I would not hide E_NOTICE is because of the php.ini of later versions of PHP:
; error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED
By default PHP will actually install for Production Value (as it does for me) as such the default for PHP error reporting is:
E_ALL & ~E_DEPRECATED
This is the value I have for error_reporting on both my AWS and my local Ubuntu server 12.04 and I have not changed the values since installing as such the default value I gain from installing PHP from both repo and source is:
error_reporting = E_ALL & ~E_DEPRECATED
So the recommended default setup for production for later PHP versions (and probably future ones) actually shows E_NOTICE, which is useful but not if the logs are being filled with stuff from the Mongo extension.
Edit: Downvoter care to explain? I have basically given the same answer as #Stennie, why the downvote?
I have edited my answer to actually take the conversation in the comments on this answer and #Stennie's answer into consideration so the answer makes more sense now.