简体   繁体   中英

PHP working on one server but not on another

I am migrating wordpress website from JustHost server to VPS (Debian 8). I have successfully installed wordpress and all pages are working fine except homepage which is blank and the only page that has different template. I have enabled debugging and I'm getting error:

Parse error: syntax error, unexpected '<' in /var/www/wp-content/themes/goldistra/front-page-presentation.php on line 19

There is obviously no error as the site is working fine on the first server.

When I remove code from line 13 to 19 in that php file, site finally shows up but it is still broken as the slideshow gallery is not opening images, twitter widget is not working and footer is not showing up.

Here is code sample from line 13-19:

 <?php/* if ( get_option('fppre_intro_heading') != '' ): ?>
                <h1><?php echo get_option('fppre_intro_heading'); ?></h1>
            <?php endif; ?>
            <?php if ( get_option('fppre_intro_text') != '' ): ?>
                <p><?php echo get_option('fppre_intro_text'); ?></p>
            <?php endif; 
            <h1><?php echo $post->post_title; ?></h1>*/?>

And here are some server infos:

1. First (working) server

    Date:   Fri, 25 Sep 2015 11:53:32 GMT   
    Server: Apache  
    Vary:   Accept-Encoding,Cookie,User-Agent   
    Cache-Control:  max-age=3, must-revalidate  
    WP-Super-Cache: Served supercache file from PHP 
    Content-Encoding:   gzip    
    Content-Length: 7165    
    Cache-Control:  max-age=3600    
    Expires:    Fri, 25 Sep 2015 12:53:32 GMT   
    Connection: close   
    Content-Type:   text/html; charset=UTF-8

2. VPS

Date:   Fri, 25 Sep 2015 12:06:00 GMT   
    Server: Apache/2.4.10 (Debian)  
    X-Pingback: http://151.236.10.228/xmlrpc.php    
    Link:   <http://151.236.10.228/>; rel=shortlink 
    Vary:   Accept-Encoding 
    Content-Encoding:   gzip    
    Content-Length: 350 
    Connection: close   
    Content-Type:   text/html; charset=UTF-8

I am using PHP version 5.6.13 on my VPS

You've missed a close php tag in line 18. That's why you get the error for line 19.

Also, you shouldn't use PHP comments in a php tag that encloses other PHP tags. Use HTML commenting instead, if you'd like to comment out multiple HTML elements at once.

It seems you have a few problems. First of all, a comment block is defined between php tags. . You can't start a comment in a php block and close the comment in other php comment. So, this should work:

<?php if ( get_option('fppre_intro_heading') != '' ): ?>
<h1><?php echo get_option('fppre_intro_heading'); ?></h1>
<?php endif; ?>
<?php if ( get_option('fppre_intro_text') != '' ): ?>
<p><?php echo get_option('fppre_intro_text'); ?></p>
<?php endif; ?>
<h1><?php echo $post->post_title; ?></h1>

or

<?php /*if ( get_option('fppre_intro_heading') != '' */ ): ?>
<h1><?php echo get_option('fppre_intro_heading');  */?></h1>
<?php /* endif; */ ?>
<?php /* if ( get_option('fppre_intro_text') != '' ): */ ?>
<p><?php /* echo get_option('fppre_intro_text'); */ ?></p>
<?php /* endif; ?>
<h1><?php /* echo $post->post_title; */?></h1>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM