• Hi, i have customized a theme which works just fine on my server.
    However, after uploading it to my client’s server, some things stopped working.

    I made a rotating background, which shifts images randomly with every page reload. The css code is:

    #rotator {
    background: url('images/rot_images/rotate.php') no-repeat center top;
    }

    It works great on my server, but on my client’s server an error_log is created:

    Cannot modify header information - headers already sent by (output started at .../public_html/wp-content/themes/lavinia/images/rot_images/rotate.php:3) in .../wp-content/themes/lavinia/images/rot_images/rotate.php on line 28

    rotate.php on line 28 reads:
    header('Location: '.$folder.$files[$rand]);

    Here is the whole rotate.php:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    The php version on my server is 5.3.13, and on my client’s – 5.2.17, though im not sure it’s the problem.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Thread Starter crowd

    (@crowd)

    Thank you Esmi, but it didn’t work. I checked up all the code, it’s perfectly clean and correct.
    The new error log claims the bad line is #1, on which there’s nothing but
    <?php
    without spaces.
    All the rest code is clean too, and it works perfectly well on the other server.

    Try reading the error again…

    Thread Starter crowd

    (@crowd)

    Sure, the new log says:

    PHP Warning: Cannot modify header information - headers already sent by (output started at .../images/rot_images/rotate.php:1) in .../images/rot_images/rotate.php on line 20

    and here is the rotate.php:

    [Code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

    No spaces in line #1, nothing at all that could cause it.

    Try looking at line 20.

    Thread Starter crowd

    (@crowd)

    Esmi, there’s only ?> in the line 20. It closes the code started in the line 1. Nothing else. No whitespaces. Do you refer that im missing something obvious?

    The issue is within your rotate.php script. And please don’t paste the script in here again. As it’s obviously over 10 lines long, use a pastebin.

    Thread Starter crowd

    (@crowd)

    Thank you Esmi.
    That’s my point – the script works fine on the first server, but buggs out when uploaded to my client’s. It means, no problem with the script.

    And thus i come to my initial question – some options of the new server (or maybe the wordpress options) cut off the .php that works fine on the old one.
    What could it be?

    The two servers will not be identical. They could be using different versions of Apache and/or PHP; have different configurations etc. It’s not unusual for a script to work on a development server and fall over on the production server. For a start, the config on a production server is probably a lot tighter in terms of security and error handling.

    Thread Starter crowd

    (@crowd)

    And so, how could this trouble be solved? Or does it mean that i should give up the whole issue altogether, since the server configs can not be changed and the exact problem defined?

    I think your best bet would be to look at a better rotate script. anything that relies on header('Location: '.$folder.$files[$rand]); is almost certain to cause problems in WP. Is that one of Matt’s old scripts, by any chance?

    Haver you looked at something like http://wordpress.org/extend/plugins/cimy-header-image-rotator/

    Thread Starter crowd

    (@crowd)

    Thanks, will do.
    It’s not even a plugin, i found it somewhere time ago, it only contained this rotate.php and a css background code.

    Thank you Esmi, you’ve been very helpful.

    No problem. I hope you find a replacement. If not, we might be able to help you come up with something that works.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Troubles after moving to a new server’ is closed to new replies.