Title: Error on Plugin Activation
Last modified: August 21, 2016

---

# Error on Plugin Activation

 *  [M A Vinoth Kumar](https://wordpress.org/support/users/vinoth06/)
 * (@vinoth06)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/)
 * Hi, I have developed new plugin from scratch, At that time it worked fine. But
   now I have tried to install in another site am getting this error.
 *     ```
       The plugin generated 130 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
       ```
   
 * Could any one please give some suggestion.
 * Am working in Widget and Setting Page. The output of the widget will be displayed
   in Sidebar.
 * You can see the coding and screenshots,
    `http://buffercode.com/wordpress-website-
   rating-plugin/`

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/#post-4433753)
 * There may be some cruft in your PHP file before the first `<?php` tag. They may
   be ignored by one system but not another. Open your file in a hex editor. The
   very first 5 hex values should be `3C 3F 70 68 70` which represents the `<?php`
   text. I’m guessing you have 130 bytes of something else before this.
 *  [Chris](https://wordpress.org/support/users/zenation/)
 * (@zenation)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/#post-4433773)
 * My guess is that you should remove the javascript code block at end.
    There are
   multiple ways you can add JS files of print code, say in the header. But you 
   should not echo anything (also not HTML or plain text or whatnot) in the plugin
   PHP file itself – only within the context of actions/hooks/filters. E.g.
 *     ```
       <?php
       add_action( 'wp_head', 'myPluginJS' );
   
       function myPluginJS() {
   
         echo "<script>function setCookie(){ document.cookie = 'bc_cookee=test; expires=Fri, 3 Aug 2015 20:47:11 UTC; path=/' }</script>\n";
   
       }
       ?>
       ```
   
 * For adding JS files you should use [http://codex.wordpress.org/Function_Reference/wp_enqueue_script](http://codex.wordpress.org/Function_Reference/wp_enqueue_script)
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/#post-4433779)
 * Yeah, what Chris said, I count 130 characters in that code!
 * Good catch Chris!
 *  Thread Starter [M A Vinoth Kumar](https://wordpress.org/support/users/vinoth06/)
 * (@vinoth06)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/#post-4433805)
 * [@chris](https://wordpress.org/support/users/chris/) : Yes you are right and 
   your code worked like charm. Thanks for your valuable suggestion in time.
 * Thanks again 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Error on Plugin Activation’ is closed to new replies.

## Tags

 * [activation error](https://wordpress.org/support/topic-tag/activation-error/)
 * [plugin error](https://wordpress.org/support/topic-tag/plugin-error/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 4 replies
 * 3 participants
 * Last reply from: [M A Vinoth Kumar](https://wordpress.org/support/users/vinoth06/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/error-on-plugin-activation-3/#post-4433805)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
