Jump to content

Syntax Error In Old Version Of Php


anevins

Recommended Posts

Hello,

 

I need to run my application on a server using PHP 5.2.4, but I'm running into troubles because I've been making it on a more recent version.

 

I have these errors:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /nas/students/a/a2-nevins/unix/public_html/year_4/dmp/app/controller/locations.php on line 23

 

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /nas/students/a/a2-nevins/unix/public_html/year_4/dmp/app/controller/locations.php on line 23

 

Parse error: syntax error, unexpected T_STRING in /nas/students/a/a2-nevins/unix/public_html/year_4/dmp/app/controller/locations.php on line 23

 

 

 

Line 23 is:

$adapter  = new \Geocoder\HttpAdapter\BuzzHttpAdapter();

 

How can I get around this?

 

Thanks,

Andrew

Link to comment
https://forums.phpfreaks.com/topic/269630-syntax-error-in-old-version-of-php/
Share on other sites

Just a little to add, the errors say "on line 23." This does not actually mean that the error is on that line. The error could of been caused anywhere above or below that line, however sometimes it is the specified line - maybe in future try posting the pages code, or the block associated with the errored line.

The code you're using relies on features only available in the newest version of PHP. Your code is not backwards-compatible, so you have to either stop using it or upgrade. Simply removing the namespaces is probably too difficult.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.