开发者

Getting what appears to be a PHP4 error on my PHP5 server

I'm getting the below error on my server:

Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c03/h03/mnt/53496/domains/chuggington.com/deploy/releases/20100908062138/system/application/models/home_model.php on line 5

However, the code works in a different part of the server (the development side). This is me trying to put it live.

Below is the code it is referring to:

<?php

class Home_model extends Model {

    public function Home_model()
    {
        // model constructor
        parent::Model();
    }

    function getCode(){
        $ip_address = 'INET_ATON('.$_SERVER['REMOTE_ADDR'].')';
        //echo $_SERVER['REMOTE_ADDR'];
        $this->db->select('country');
        $this->db->order_by('ip', 'desc');
        $query = $this->db->get_where('ip2nation', array('ip <'=>$ip_address), '0,1');
        //print_r($query->row('country'));
        return $query->row('country');
    }
}
?>

Can syslink cause this sort of error? There are no htaccess script开发者_运维问答s interfering either.

Thanks

---EDIT---

I have run a phpinfo on the site and it's running php 5.2.6. I'll try the addhandler change and see if that works.

Just tried the addhandler and i'm still getting the same error.


Some hosts may offer both PHP4 and PHP5 environments and require you to choose one or the other, defaulting to PHP4. Our host requires a AddHandler php5-script .php line in the .htaccess file of directories that should use PHP5. Others may offer a switch in a control panel.

Consult your host's manual.


Remove "public". And put a phpinfo(); on top of that file. Find out what's wrong.

There's probably an alternative PHP4 interpreter installed, and whatever script accesses your class runs in that context.


Is there any other code in the same file? This error seems to me like another class or function hasn't been closed properly with a bracket } above. Or something of the kind.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜