PHP在一台服务器上工作,但不在另一台服务器上
我正在将WordPress的网站从JustHost服务器迁移到VPS(Debian 8)。我已经成功安装wordpress,除了空白的主页和具有不同模板的唯一页面以外,所有页面都可以正常工作。我已经启用调试和我收到提示:PHP在一台服务器上工作,但不在另一台服务器上
Parse error: syntax error, unexpected '<' in /var/www/wp-content/themes/goldistra/front-page-presentation.php on line 19
显然有没有错误的网站工作正常的第一台服务器上。
当我从第13行到第19行的php代码中删除代码时,网站终于显示出来,但由于幻灯片库没有打开图像,所以它仍然被破坏,Twitter小部件不工作,页脚不显示。
下面是从线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>*/?>
这里有一些服务器的相关信息:
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
我使用的PHP版本5.6.13对我的VPS
你已经错过了第18行关闭php标签。这就是为什么你得到第19行的错误。
另外,你不应该在包含其他PHP标签的php标签中使用PHP注释。如果您想同时注释多个HTML元素,请改用HTML注释。
看来你有几个问题。 首先,在php标签之间定义了一个注释块。 。你不能在一个php块中开始评论,并关闭其他php评论中的评论。 所以,这应该工作:
<?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>
或
<?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>
确定你的第一个代码片段工作正常,但我的网站仍然是坏的。看看这里151.236.10.228。这里是整个front-page-presentation.php:pastebin.com/FiLRa37D –
不恰当评论,并检查PHP代码,请检查您的线从13至19 13个 – Prafulla
线条实际工作评价(没有表现出良好的位置),所以有只保留但nvm,当我删除那些行仍然我的网站坏了:http://151.236.10.228/ +我有mySQL错误,我没有设法解决,但我发现那些不影响网站布局。 –
这是整个front-page-presentation.php:http://pastebin.com/FiLRa37D –