We're getting this error in our test environment:

Parse error: syntax error, unexpected 'var' (T_VAR) in /home/usaspo5/public_html/dev/usgnew/components/com_usg_programs/tmpls/default.php

We have the same code on the live site and it does not produce these results.

  • Does your live site have errors turned on?
    – RichardB
    May 30 '17 at 18:40
  • I do not believe so. Is there anyway around this. I need to be able to use that page for search feature testing
    – user11029
    May 30 '17 at 18:41
  • I turned off the error reporting and it did nothing for the issue on the test site
    – user11029
    May 30 '17 at 18:52
  • check the versions of PHP on each server May 31 '17 at 2:19
  • They're the same Server. So they have the same php version. I misspoke We use it as a test server but it's more of a test environment
    – user11029
    May 31 '17 at 12:44

It seems that you have a simple error. You have an extra quote or double qoute in your code like this:

"function(){"var x=jQuery('#id') "

In PHP you can only use var keyword in class to define variable! so, it seems that you have String break some were in js code within php file OR you did not close php tag like ?> before js code

  • Okay, would php asp code <%%> cause issues when using var?
    – user11029
    Jun 1 '17 at 18:00
  • According to php documentation the ASP tags <%, %>, <%=, and the script tag <script language="php"> are removed from PHP ver 7.0.0. If you use php ver 7 asp tags will not work Jun 1 '17 at 18:16
  • We are using 5.4.0 and <script type="text/html">
    – user11029
    Jun 1 '17 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.