duanreng3439 2014-04-29 22:09
浏览 61
已采纳

Debian PHP 5.4.27与Ubuntu PHP 5.4.16

Well, I'm transferring a little web server from one computer to other, on the 'other' computer I cannot a more updated version of PHP,

I just have to add my files through ssh and that's all, when I load my webpage it says explicitly:

The error is showing on a Debian with PHP 5.4.27 squeeze, the webserver comes from an Ubuntu with PHP 5.4.16 oneiric

Parse error: syntax error, unexpected '[' in ~directory~ on line 38

This is the line 38.

$VALUE=$DB->query("a nice sentence")->fetch()[0];

So, i was pretty surprised because PDO was accepted since PHP 5.1, so, i look deeper and i found the possible error, you can't simply do ->fetch()[0], you must separate it in order to be "processed",

However, I have transport this server with this information before, so i really don't know if it's something on the configuration of PHP or maybe the version by itself 5.4.X? You guys know any hint? As I said, i can't just install other updated version of PHP5, what do you recommend?

Have a nice night.

Edit: updated to the issue on the PHP 5.4 now

  • 写回答

3条回答 默认 最新

  • dongye1942 2014-04-30 13:07
    关注

    Apparently, the error was solved by JUST changing the first issue line (the other hundreds of codes that had that wasn't necessary to change, what i believe to be a little weird).

    $VALUE = $DB->query("a nice sentence")->fetch()->offset(0);
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 树莓派与pix飞控通信
  • ¥15 自动转发微信群信息到另外一个微信群
  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题