0

I'm new to PHP and MySQL. When I run my files on the localhost, everything runs just perfect! But when I upload all files to live real domain I get this:

PHP Parse error: syntax error, unexpected T_OBJECT_OPERATOR in C:\Domains\xyz.com\wwwroot\123\index.php on line 26

This is line 26 in index.php:

GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);

My web hosting provider has PHP and MySQL.

Any help is highly appreciated.

This is it:

function GetConnectionOptions()
{
    $result = GetGlobalConnectionOptions();
    $result['client_encoding'] = 'utf8';
    GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);
    return $result;
}
10
  • 2
    Post the line which precedes this one. The actual error is probably there (like a missing quote or ;) Commented Jan 23, 2013 at 14:10
  • GetApplication() apparently doesn't return an object Commented Jan 23, 2013 at 14:10
  • @JohnConde Wouldn't that result in call to member function GetUserAuth... on a non object? Commented Jan 23, 2013 at 14:11
  • It is working 100% right on localhost. Commented Jan 23, 2013 at 14:11
  • 1
    @StillTrying Post it as an edit above, not down here in the comments please. Commented Jan 23, 2013 at 14:13

2 Answers 2

3

This was introduced in PHP 5. Where ever you are deploying to really needs an update because it is running PHP 4.

Test case:

<?php
class TestingClass
{
    function test()
    {
        return $this;
    }
}
function test()
{
    return new TestingClass();
}

test()->test();

PHP Lint v5.0.0:

C:\PHP500>php -l E:\testcase.php
No syntax errors detected in E:\testcase.php
C:\PHP500>php -v
PHP 5.0.0 (cgi-fcgi) (built: Jul 13 2004 21:39:41)

PHP Lint v4.4.9:

C:\PHP449>php -l E:\testcase.php
<br />
<b>Parse error</b>:  syntax error, unexpected T_OBJECT_OPERATOR in <b>E:\testcase.php</b> on line <b>16</b><br />
Errors parsing E:\testcase.php
C:\PHP449>php -v
PHP 4.4.9 (cgi-fcgi) (built: Aug  7 2008 15:04:24)
Sign up to request clarification or add additional context in comments.

Comments

0

There is a space between - and >

GetApplication()->GetUserAuthorizationStrategy()- >ApplyIdentityToConnectionOptions($result);

This means "minus greater than". Remove the space.

2nd try: Is GetApplication really a function?

2 Comments

Sorry the space was only a mistake while coping the code here. Thanks
YES, 100% fine in localhost

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.