0

I have WordPress multisite install, everything was working properly. Developed a custom pugin on my local server (same configuration of Nginx, PHP, MySQL, Memcached, the only difference is OS - Windows 7 locally vs Ubuntu 14.04 LTS on server) and it works just fine. Plugin handles custom front-end reistration, login, password reset and user activation, custom profile page and profile editing (profiles are custom post type with some custom taxonomies). All forms are submitted via ajax. Everything works locally.

When I try to activate the plugin on a server it kind of activates but completely messes up cyrillic encoding and prints some code from my plugin files on top of the pages (frontend and backend).

Tried to disable all plugins and themes, revert to default. I even switched to new empty database, installed network again and activated on a fresh install. Same error.

I also have this function in one of my files:

add_action( 'init', 'feup_output_buffer' );
function feup_output_buffer() {

    ob_start();

}

So it can't be 'header already sent' issue (and if yes - it would throw a php warning). Debug is on, no php errors, warning or notices. Any ideas?

Here's the screenshot

enter image description here

  • The ob_start must be the problem, there are any other functions like that one? – Tomás Cot Sep 4 '14 at 15:11
  • In my code - no. Maybe in other plugins. Checking right now. – Ihor Vorotnov Sep 4 '14 at 15:16
  • Removed this function - problem is still present. – Ihor Vorotnov Sep 4 '14 at 15:21
  • and, btw, ob_start is a stackable function so it allows multiple instances. – Ihor Vorotnov Sep 4 '14 at 15:47
  • The problem is that it isn't used correctly PHP ends up flushing on EOF – Tomás Cot Sep 4 '14 at 15:56
0

Tried everything, finally rebuilt the plugin from ground up, split into several smaller ones. Installed and activated one by one and the problem was fixed. Everything works now.

0

If someone else stumbles upon this thread, the problem was likely caused by using the PHP short open tag feature (<? ?> vs. <?php ?>), whereas the short_open_tag directive was disabled on the server.

  • Sergey, thanks for your input. However, I NEVER use short open tags. Never used them since I started writing PHP code years ago. – Ihor Vorotnov Aug 31 '15 at 9:48
  • I don't use them too, but yesterday found one that accidentally slipped in :) Anyway, that is the only scenario where I could reproduce this exact issue. – SergeyBiryukov Aug 31 '15 at 14:08
  • Yep, you're right. But in my case it wasn't the reason. However, I couldn't reproduce the issue again as I rewrote the code and the problem was somehow solved. I tend to think there was an extra byte before some opening tag. – Ihor Vorotnov Sep 1 '15 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.