首页 资讯 电脑入门 操作系统 上网 办公 技巧 硬件 软件 网络 图像 多媒体 程序 数据库 网页网站 网游 安全 加密 企业

WP技巧以及出现错误提示修复的案例几则

巧巧电脑网络 2012-06-18     收藏此文 
出现“Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/wp-db.php:958) in /home/web/xxx/www.xxx.com/wp-includes/pluggable。

1、在WordPress中如何在数据库中删除冗余数据?

答:利用下列语句删除相应的表即可:

1)、DELETE FROM wp_posts WHERE post_type = ‘revision’;

2)、DELETE FROM wp_postmeta WHERE meta_key = ‘_edit_lock’;

3)、DELETE FROM wp_postmeta WHERE meta_key = ‘_edit_last’;

2、出现“WordPress database error: [MySQL server has gone away]”的提示是怎么回事?

答:这个可能是由于数据库链接超时的原因导致的。询问你的数据库管理员或者网站托管商,数据库最近是否超载导致无法访问网站。

也可能是由于某些插件不能正常工作导致的,可是尝试如下语句:

SELECT autoload FROM wp_options WHERE option_name = '_site_transient_update_plugins'

另外,该处给出一些英文的解决方案。时间关系,没有来得及翻译,暂且保留英文原版吧:

A. Try flushing out the transient data(options prefixed with _site_transient_update_ - wp_options table), WP will recreate them for you anyway.

B. Not always a solution but tends to work for me when i have that problem.

C. You can do this by adding the following lines to your current theme's functions.php (in wp-content/themes/YOURTHEME/functions.php).

delete_option( '_site_transient_update_core' ); delete_option( '_site_transient_update_themes' ); delete_option( '_site_transient_update_plugins' ); NOTE: You probably only need the first one, but i usually flush them all if i'm flushing one(can't hurt to have a refresh).

D. Load any page up once, admin page, post page, whatever, then remove the code(it only needs to run for one page load).
=====================================================================================================================================

3、出现“Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/wp-db.php:958) in /home/web/xxx/www.xxx.com/wp-includes/pluggable.php on line 997”之类的错误或者是“The plugin does not have a valid header.” msgstr "插件的头部错误。"之类的错误怎么办?

答:一下给出英文解决方案。也是由于时间关系没有翻译出来,各位自己看一下:

解决方案思路一:

We have found with some free wordpress plugins, they have started to generate errors when added and activated within wordpress. The error will show when the plugin is activated and will state “Plugin Does Not Have a Valid Header”.

The reason is very simple. While most plugin developers zip their plugin folder with any extra txt files required, but some other developers are putting the plugin folder within another folder. This second practice causes a problem as the plugin should consist of a folder with files and other folders inside, creating a second incorrectly named layer causes wordpress to look for the wrong files and thus assume that the header is missing or invalid.

You should download the plugin to your pc, extract it and check to see if it does have one folder directly inside the other. Login via ftp and delete the folder that was created when you added the plugin within your blog. Finally, upload the correct folder from your pc, login to your blog and click on activate next to the plugin you uploaded.

An example of this is “TubePress.NET 3.0.1″. This plugin has been placed inside a folder which cause the header error when it is activated. By downloading it and only uploading the correct folder it stopped the error from being displayed because the folder that the plugin was in had the correct name. Plugin folders will normally contain a file with an identical name to the folder. When this folder is placed within another folder, it loses the ability to work and be recognised by wordpress.

解决方案思路二:

So let’s say you’re working with Wordpress 2.8 and you went to install a new plugin.  Excited about the new plugin, your hope goes down because of this message, “The plugin does not have a valid header“. Well I have an easy fix for that.

As soo as you go to activate the plugin that’s when you see that error message. Just simply click on installed plugins then “inactive” plugins and retry.  It should work like a charm!

解决方案思路三:

Guys, I've found an workaround. Just move plugin files to /plugin root. For example:

/wp-content/plugins/akismet/akismet.php

Move akismet.php to

/wp-content/plugins/akismet.php

Your plugins' folder will be a messy, but at least missed plugins will come back and work.

Anyway, I'm still waiting an official solution from Automattic. WP 2.8.1, may?

I find another way to solve this problem.

解决方案思路四:

WP 2.8.3 and plugins

As someone mentioned, some plugins will only install manually like we used to do before the automatic install feature.

Unzip the plugin folder and upload it via FTP into the wp-content/plugins/ folder.

Make sure you ONLY upload the plugin folder:

wp-content/plugins/askimet = good
wp-content/plugins/askimet/askimet = not good

That's why the header can't be found, it doesn't seem to discard the "shell" folder.

Hope this helps!

styzer

解决方案思路五(安装插件时注意必须要有下列头文件):

If you are creating a new plugin make sure that you have this in your main plugin file.

<?php
/*
Plugin Name: Name Of The Plugin
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: The Plugin's Version Number, e.g.: 1.0
Author: Name Of The Plugin Author
Author URI: http://URI_Of_The_Plugin_Author
*/
?>

参考资料,如何写一个WP的插件:
http://codex.wordpress.org/Writing_a_Plugin

这里还有一篇文章参考一下:

我就是按照这里说的解决方案搞定的: http://imeshootings.com/blog/howto-wordpress/plugin-not-valid-header

I also ran into this problem recently. In the end it's to do with the permissions on the plugins directory. The web server needs write access to certain files when they are uploaded. If your server is running with group write permissions, the upload script doesn't necessarily set the group write bit on the necessary files, only owner write permission.
Richard Feraro

另一个关于错误的解答:
http://mysillypointofview.wordpress.com/2010/05/27/fix-the-plugin-does-not-have-a-valid-header-error/

I've had the same problem. Drove me insane. Here's how I found a fix.

In the "Install New Plug Ins" page, rather than UPLOAD your plug in from your desktop or download file (which is where you'll probably be loading the file from) SIDE STEP this step by using the SEARCH function to find the plug in on the WordPress.org site, then press "SEARCH PLUG INS".

If the plugin you're looking for is on the main WordPress.org site, you ought to be able to find the plug in you're looking for pretty easily, then, once you find the plug in, way over on the right hand side of the page there's a wee link that says "Install".

Hit that button and bingo! Your plug in ought to be installed and activated all in one go. Try it and see if it works. It worked for me. How? Dunno. Frankly, I don't CARE, all I know is that this simple, simple step saved the second half of my day.

*************************************************************************************************
需要提醒的是:出现这类错误往往是由于安装插件引起的,因此必须严格按照wp插件的说明文件来安装插件。
*************************************************************************************************
Ran into a problem with installing a plugin today that returned a "Plugin does not have a valid header" message in WordPress. I guessed the problem almost instantly but I figured I would share the solution for anyone that might be searching for it.

Apparently there have been problems in at least one version of WordPress where an automatic update caused this error but in most cases the error is probably due to the folder structure of the plugin you just installed. In my particular case the plugin I was trying to install was in a folder...something like pluginname-20. Within this folder was another folder named pluginname.

WordPress needs at least the basic plugin file to be in the first folder it checks for the plugin so the solution was to upload only the folder named "pluginfolder" with all contents. The pluginname-20 folder was unnecessary and I really am not sure why the plugin was submitted that way.

This problem is easy to run into if you're using something like the One Click Plugin Updater plugin. The plugin lets you install other plugins by uploading the zip files directly and you may not catch the weird folder structure.

4、我的WP系统的网站登录后出现下列错误怎么办?

第一次登录信息出现如下信息:

Warning: fopen(http://www.xxx.com/wp-cron.php?doing_wp_cron) [function.fopen]: failed to open stream: HTTP request failed! in /home/web/xxx/www.xxx.com/wp-includes/class-http.php on line 1063

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1073) in /home/web/38huo/www.xxx.com/wp-login.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1073) in /home/web/38huo/www.xxx.com/wp-login.php on line 376

第二次登录信息得到如下的错误,是怎么回事呢?

Warning: fopen(http://www.xxx.com/wp-cron.php?doing_wp_cron) [function.fopen]: failed to open stream: HTTP request failed! in /home/web/xxx/www.xxx.com/wp-includes/class-http.php on line 1073

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-login.php on line 364

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-login.php on line 376

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-includes/pluggable.php on line 703

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-includes/pluggable.php on line 704

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-includes/pluggable.php on line 705

Warning: Cannot modify header information - headers already sent by (output started at /home/web/xxx/www.xxx.com/wp-includes/class-http.php:1063) in /home/web/38huo/www.xxx.com/wp-includes/pluggable.php on line 907

解决方案:

你把php.ini里面查看看,要把output_buffering的off改成on或者4096 php.ini output_buffering = on;

回顾文章:精华推荐:Excel实用技巧九则

Excel是我们大家常用的办公软件,笔者在使用过程中总结出了一些经验,现在写出来供大家参考。 1、不使用方向键也可上下左右移动所选定单元格 因工作需要,笔者在Excel多个单元格中输入大量文本,大家都知道,在Excel中,如果要选定已选定单元格右侧的单元格,可以按下方向键进行移动。

下一篇:
本类最热图文
Google
巧巧电脑网络编辑信箱  告诉我们您想看的专题或文章