Quite a long time ago I wrote an external script that does this at the top:
$config = CRM_Core_Config::singleton( );
...so that I can use civicrm_api() calls from an external php script. Now after upgrading to the 5.x train of CiviCRM I realized my script was not working. If I manually run the script I get this error:
PHP Parse error: syntax error, unexpected '$this' (T_VARIABLE) in .../civicrm/CRM/Core/DAO.php on line 1123
In an effort to determine if this was happening in a civicrm_api() call I made a file with just the three lines quoted above and run it with php, and it produces the error. So I'm pretty confident the issue is the require_once trying to include these files, not the actual act of making an api call.
I've found numerous references to $this issues in DAO.php, but none of them are relevant to including these two files for the purposes of API calls and the line number of the failure is always different.
How can I fix this so I can use my existing script?