WordPress.org

Ready to get started?Download WordPress

Forums

Troubles after moving to a new server (14 posts)

  1. crowd
    Member
    Posted 2 years ago #

    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.

  2. esmi
    Forum Moderator
    Posted 2 years ago #

  3. crowd
    Member
    Posted 2 years ago #

    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.

  4. esmi
    Forum Moderator
    Posted 2 years ago #

    Try reading the error again...

  5. crowd
    Member
    Posted 2 years ago #

    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.

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    Try looking at line 20.

  7. crowd
    Member
    Posted 2 years ago #

    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?

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  9. crowd
    Member
    Posted 2 years ago #

    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?

  10. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  11. crowd
    Member
    Posted 2 years ago #

    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?

  12. esmi
    Forum Moderator
    Posted 2 years ago #

    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/

  13. crowd
    Member
    Posted 2 years ago #

    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.

  14. esmi
    Forum Moderator
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic