仅在 Windows 服务器上的 PHP 错误

标签 php parsing syntax-error wamp lamp

我不知道从哪里开始修复这个。我有一个带有 Ubuntu 和 Windows 的双启动服务器。在 Ubuntu 中,一切正常,但在 Windows(使用 WAMP)中,我的一些站点上出现神秘的 PHP 错误,而其他站点(使用 PHP)运行正常。

Ubuntu screenshot http://newplayproject.org/wp-content/uploads/2012/10/screenshot-windows.jpg

因为它在 Ubuntu 中运行良好,我猜我的代码实际上没有错误,但我在 Windows 上缺少一些 PHP 模块。有任何想法吗?

作为对其中一条评论的回应,这里是“loop-blog.php”的内容:

<?php
global $options;
foreach ($options as $value) {
if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
}
?>
<?php get_header(); ?>
<? if ($xs_enable_static_feature == "false") { ?>
    <? } else { ?>
    <img src="<?php header_image(); ?>" alt="Static Image" class="static-image" width="880" height="280" title="Static Image" />
<? } ?>
    <? if ($xs_disable_slider== "true") { ?>
    <? } else { ?>
        <?php get_template_part( 'nivoslider' ) ?> 
<? } ?>
    <div id="main">
<h1>Latest Posts</h1>
    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); $thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large'); ?>
            <div class="post">
                <div class="postcontent">
            <?
            // Checks To See If, Thumbnails Are Disabled
            if ($xs_disable_thumbnails_archieve == "true") { ?>
            <?
            //If Not Disabled, Show Thumbnails
            } else { ?>
            <div class="postimg">
                    <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php 
                    if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) {
                        echo $thumbnail[0]; 
                    } else {
                        $postimage = get_post_meta($post->ID, 'post-image', true);
                        if ($postimage) {
                            echo $postimage;
                        } else {
                            echo catch_that_image();
                        }
                    }
                    ?>&amp;h=<?php echo $xs_thumbnail_height ?>&amp;w=<?php echo $xs_thumbnail_width ?>&amp;s=1" width="<?php echo $xs_thumbnail_width ?>" height="<?php echo $xs_thumbnail_height ?>" alt="<?php the_title(); ?>" /></a>
            </div><!-- /postimg -->  
            <? } ?>
            <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <?php the_excerpt(); ?>
        </div><!-- End Post Content -->
                </div><!-- End Post -->
<?php endwhile; ?>
<?php endif; ?>
        <?php
            //Check For the Page Navi Plugin
            if (function_exists('wp_pagenavi')) {
                wp_pagenavi();
            //Show Default Navigation if Page Navi Is Not Installed
            } else { ?>
                <div class="paginate">
                    <div class="paginate-left"><?php previous_posts_link('Newer Posts') ?></div>
                    <div class="paginate-right"><?php next_posts_link('Older Posts') ?></div>
                </div><!-- /paginate -->
            <? } ?>
</div><!-- End Main -->     
<?php get_sidebar(); ?> 
<?php get_footer(); ?>

最佳答案

我的猜测是你没有 short_open_tag在 Windows 上启用,因此缺少一些 PHP block 。

检查 phpinfo() 的输出如果 short_open_tag已开启。如果不是,请在您的 php.ini 文件中启用它。

关于仅在 Windows 服务器上的 PHP 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12878744/

相关文章:

arrays - 为什么返回 'error: unbound symbol' 为什么我运行我的数组比较算法?

python - 语法错误: can't assign to function call in Python

php - 显示列名称和值

php - FFMPEG PHP - 将 gif 转换为 mpeg

php - 如何在MYsql中存储复选框?

php - 从两个表中选择 INNER JOIN 未按预期运行

java - java中复杂的Json解析

c# - 树结构作为字符串 - 如何匹配嵌套大括号?

sql - 以正交方式向数据库查询添加条件

php - PHP解析错误: syntax error, unexpected '?' [duplicate]