dtt5830659 2014-08-27 14:22
浏览 37

PHP解析错误; localhost与host的不同行为。 php.ini负责吗?

I've found this free template for Joomla. There is a quickstart package to get a ready-to-go website, similar to the demo. First I've installed XAMPP v1.8.3 (with PHP v5.5.14) on my Windows pc and then I succesfully get the demo working on my localhost. Then I tried to move the website to my online host (Linux, PHP v5.5.11). I moved all the files with FileZilla and the local MySQL database with a sql script, as illustrated by Joomla. When I open the home page of my website I can't see the demo and I get this error instead:

Parse error: syntax error, unexpected end of file in /web/htdocs/www.mywebsite.com/home/modules/mod_otslideshow/classes/otimage.class.php on line 1

This is the content of the file:

<?php
/* Credits - cut -*/
defined('_JEXEC') or die('Restricted access');
class OTImage {
//cut
}

Brackets are ok. Notepad++ shows me that the last "}" closes the OTImage class (if you want the very long code of the class I can provide it). I'm not a PHP experts, but I noticed that there was a missing PHP close tag ?>. Then I read that it is not a syntax error. What could be the reason for this error? Localhost PHP version is similar to the remote host. Is it something related to the migration? Or something related to the php.ini? My provider gives me an option to change the php.ini: there are 5 options. The first two seems to be interesting. With the first (default one) - and also the others - I get the aforementioned error; with the second (joomla specific) I get no error, but I see a blank home page. By adding a final ?> to the class I'm able to see the homepage, but the slideshow (the module that is causing problem) doesn't work (I see all the images in the page, without the slider: the component is broken). I can't understand if there is an incompatibility or a programming error. Thanks in advance.

EDIT: phpcodechecker.com says that the code is syntatically correct.

  • 写回答

1条回答 默认 最新

  • doukong5394 2014-08-27 19:33
    关注

    Usually this occurs when a php file is corrupted or not fully transfered.

    Did you move the site via ftp.

    If ftp then has it finished?

    Did you got any errors on transfer?

    Remember you have a "on line 1".

    评论

报告相同问题?

悬赏问题

  • ¥15 Mac系统vs code使用phpstudy如何配置debug来调试php
  • ¥15 目前主流的音乐软件,像网易云音乐,QQ音乐他们的前端和后台部分是用的什么技术实现的?求解!
  • ¥60 pb数据库修改与连接
  • ¥15 spss统计中二分类变量和有序变量的相关性分析可以用kendall相关分析吗?
  • ¥15 拟通过pc下指令到安卓系统,如果追求响应速度,尽可能无延迟,是不是用安卓模拟器会优于实体的安卓手机?如果是,可以快多少毫秒?
  • ¥20 神经网络Sequential name=sequential, built=False
  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)