Wordpress charset error only happening occasionally - wordpress

I get the following error on my website, it only happens occasionally.
The host conpany say it is cause dby not using mysql_close in all scripts but I thought PHP did that by default. Either way, I have the standard wordpress installtion so not sure which script could be causing this.
Warning: mysql_set_charset(): Error executing query in /mysite.com/wp-includes/wp-db.php on line 715
Warning: Cannot modify header information - headers already sent by (output started at /mysite.com/wp-includes/wp-db.php:715) in /mysite.com/wp-includes/pluggable.php on line 1121

Why don't you just disable errors / warnings? Put error_reporting(0); in wp config file wp-config.php exactly below call of wp-settings.php and it won't display any errors / warnings.
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
error_reporting(0);

Related

WP-Super-Cache activation errors

I have to set up the cache on a WordPress project, which is already on "support mode" in the agency for a while.
The plugin WP Super Cache was already installed so I activated it, to setting up it.
I work locally on dev mode and the project have a preprod and a prod environments.
When I activated it, the following error messages appear in back-office :
Warning:
include(/var/www/xx/xx/xx/xx/xx/xx/wp-content/plugins/wp-super-cache/wp-cache-base.php):
failed to open stream: No such file or directory in
/var/www/wp-content/plugins/wp-super-cache/wp-cache.php on line 65
Warning: include(): Failed opening
‘/var/www/xx/xx/xx/xx/xx/xx/wp-content/plugins/wp-super-cache/wp-cache-base.php’
for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in
/var/www/wp-content/plugins/wp-super-cache/wp-cache.php on line 65
Warning:
include_once(/var/www/xx/xx/xx/xx/xx/xx/wp-content/plugins/wp-super-cache/ossdl-cdn.php):
failed to open stream: No such file or directory in
/var/www/wp-content/plugins/wp-super-cache/wp-cache.php on line 82
Warning: include_once(): Failed opening
‘/var/www/xx/xx/xx/xx/xx/xx/wp-content/plugins/wp-super-cache/ossdl-cdn.php’
for inclusion (include_path=’.:/usr/share/php:/usr/share/pear’) in
/var/www/wp-content/plugins/wp-super-cache/wp-cache.php on line 82
Looking in the file wp-cache.php on lines 65 and 82, it says that :
include(WPCACHEHOME . 'wp-cache-base.php');
Path ‘dirname(FILE).’/…wp-cache-base.php’ not found Include
expression is not resolved
include_once( WPCACHEHOME . 'ossdl-cdn.php' );
Path ‘dirname(FILE).’/…ossdl-cdn.php’ not found Include expression
is not resolved
So I was thinking about changing the path. However, this is bothering me because I am afraid that this action will be potentially a troubleshooting cause when the plugin will have to be updated.
I have no ideas how I can fix it.
Uninstall and reinstall the plugin ?
Use an other plugin to manage the cache?
Thank you in advance for your answers. Have a nice day!
WP Super Cache puts the below line in your wp-config.php file. Remove the line from your wp-config.php file and reinstall and reactivate the plugin.
define( ‘WPCACHEHOME’, ‘/home/USERNAME/public_html/wp/wp-content/plugins/wp-super-cache/’ ); //Added by WP-Cache Manager
I encountered the same problem after moving my Wordpress directory to the root of my site. If you get the problem and can't deactivate the erroring plugin, go to your /wp-content/plugins/wp-super-cache and remove or rename the directory. This will manually deactivate this so you can install a fresh instance.

Can't access WP-Admin page because of error

I am trying to edit a website I made in Wordpress, but when I go to the example.com/wp-admin/ to get to the Admin,
I get the errors, and so there is no way to go into Wordpress to edit the site.
I even changed the WP Theme back to the default TwentyTen through PHPMyAdmin, but that didn't help.
What can I do? Here is what I get when I try to go to wp-admin page:
Notice: register_uninstall_hook was called incorrectly. Only a static
class method or function can be used in an uninstall hook. Please see
Debugging in WordPress for more information. (This message was added
in version 3.1.) in
/home/content/80/13163980/html/ybk/wp-includes/functions.php on line
3547
Notice: Undefined index: page in
/home/content/80/13163980/html/ybk/wp-content/themes/rt_infuse_wp/functions.php
on line 45
Notice: Undefined index: page in
/home/content/80/13163980/html/ybk/wp-content/themes/rt_infuse_wp/functions.php
on line 55
Warning: Cannot modify header information - headers already sent by
(output started at
/home/content/80/13163980/html/ybk/wp-includes/functions.php:3547) in
/home/content/80/13163980/html/ybk/wp-includes/pluggable.php on line
1178
I just set WP_DEBUG mode to false and that skipped it all and got me to the WP-Admin login page.
Just find the pluggable.php and after <?php please add this ob_start(); and save. That should work.
Warning: Cannot modify header information - headers already sent by
Removing "blank lines" from function.php file and check it now issue is as it is than after check plugin folder >> disable plugin and check
Refresh your Browser, and the original error message Should go away.

How to eliminate error warnings about ini_set?

my wordpress error log is filling up with this message:
PHP Warning: ini_set() has been disabled for security reasons in
/home/mywebsite/public_html/wp-includes/load.php on line 271
that line reads: ini_set( 'display_errors', 0 );
any suggestions on how to eliminate error warnings?
You are seeing that error because the XMLRPC_REQUEST constant is set to true, which causes WordPress to try and disable error reporting with the following:
if ( defined( 'XMLRPC_REQUEST' ) )
ini_set( 'display_errors', 0 );
Editing core Wordpress files is not recommended. They will be overwritten when you update or autoupdate. The correct way to correct for this is to edit the php.ini file on the server and remove ini_set from the disable_functions directive.
You could also set display_errors to Off, or alternatively change the error_reporting directive as well to prevent warnings from being shown.
error_reporting = E_ERROR
You could also try using the error_reporting() PHP function in wp-config.php to try and disable warnings as well.
// Turn off all error reporting
error_reporting(0);
// Only show errors
error_reporting(E_ERROR);
One other suggestion I have never tried to is to override the php.ini values via .htaccess which may or may not work on your host - see this guide.

Apache, Mod_security, and Wordpress, can't remove by rule ID

I have been look around trying to get this working right for a while now, and finally bit the bullet and posted here.
I've got a LAMP stack with ModSecurity using the OWASP core rule set (v 2.2.5) and just installed Wordpress. I expected conflicts with ModSecurity, but I haven't been able to ignore or work aroudn the only error I've encountered so far.
The Apache error.log file and the modsec_audit.log both list the same error:
ModSecurity: Rule 7f5d9a449228 [id "950901"][file "/etc/modsecurity/owasp-crs/activated_rules/modsecurity_crs_41_sql_injection_attacks.conf"][line "77"] - Execution error - PCRE limits exceeded (-8): (null).`
I've tried creating a new .conf file where the crs conf files are located containing
<LocationMatch .*>
<IfModule mod_security2.c>
SecRuleRemoveById 950901
</IfModule>
</LocationMatch>
and even removed the IfModule statement and then LocationMatch statement when it didn't work.
Finally I resorted to commenting out lines 76 and 77 in the .conf file, and the error still appeared. This also had no effect.
Only changing SecRuleEngine to Off in modsecurity.conf finally let me access the page. Of course this defeats the purpose of ModSec.
Where am I going wrong?
Try adding this to your php.ini file (or included conf file):
pcre.backtrack_limit = 10000000
pcre.recursion_limit = 10000000
And then this to your modsecurity.conf:
SecPcreMatchLimit 150000
SecPcreMatchLimitRecursion 150000
This should allow for recursion without having to fully disable mod_security.

Multiple Warning: session_start() [function.session-start]

I am trying to help install a third party theme onto a WordPress installation and I get these three error codes when I click "live preview" or "activate" the theme:
Warning: session_start() [function.session-start]: open(/var/chroot/home/content/66/5232766/tmp/sess_1n0eifrftmjfu96hop17kihi35, O_RDWR) failed: No such file or directory (2) in /home/content/66/5232766/html/wp-content/themes/Drlawyer/functions.php on line 461
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/66/5232766/html/wp-content/themes/Drlawyer/functions.php:461) in /home/content/66/5232766/html/wp-content/themes/Drlawyer/functions.php on line 461
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/66/5232766/html/wp-content/themes/Drlawyer/functions.php:461) in /home/content/66/5232766/html/wp-content/themes/Drlawyer/functions.php on line 461
How can I fix these things?
try commenting the line out and removing your addition
function cp_admin_init() // { if (!session_id()) session_start(); }
If this is godaddy hosting you might need to do this (I run into this problem all the time)
Add this to your php5.ini file then you will need to kill all processes from your godaddy hosting control panel and it will work. check your phpinfo.php file to make sure it took
upload_tmp_dir = /var/chroot/home/content/56/10594156/html/temp
session.save_path = /var/chroot/home/content/56/10594156/html/temp
of course change the pathto to yours and then create a /temp dir in your root and CHMOD 777
Godaddy has issues with the tmp/ dir for some reason

Resources