0

My system is using ubuntu 12.10 and apache 2.2.22 and using doctrince 2.4. I updated my Php from 5.4.x to 5.5.38. But i still countered this error:

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) in /var/www/xxxxxx/vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php on line 62

At first, i thought it was my php 5.4 caused and then i updated php to 5.5.38. Yet i still get this error. I really have no idea how to fix it. I can't update Ubuntu's packages from outside of the server. Please someone help me.

Haruji Burke
  • 449
  • 1
  • 4
  • 17
  • Line 62 of this class contains Proxy::class (class name resolution). This feature definetly supported by PHP 5.5. So, are you sure that code works on 5.5? (try to add phpversion() call directly before this line). – Timurib Nov 17 '16 at 11:54
  • on my desktop i am using php 5.5.x and working smoothly. And hwne i get my chance to lay my finger on the server then i knew it's using php 5.4. on searching on google, someone claim that doctrince/common need at least php5.5. That's why i updatae my php – Haruji Burke Nov 17 '16 at 11:57
  • MyPhp can't parse here: `protected $placeholders = [ 'baseProxyInterface' => Proxy::class, 'additionalProperties' => '', ];` – Haruji Burke Nov 17 '16 at 12:01
  • i tried add `phpversion()` and get `unexpected 'phpversion' (T_STRING)` – Haruji Burke Nov 17 '16 at 12:02
  • i'm not sure i understand you correctly: i meant to add something like that: `var_dump(phpversion());` at line before 62 (or in any other place that parsed/executed early). – Timurib Nov 17 '16 at 12:11
  • OMG! you are right. i tried it and got '`5.4.6-1ubuntu1.8`. I can't believe. I did update and use `php --version ' or something like that. Why did the parser still use php 5.4 ??? I dowloaded from php.net then installed manually. – Haruji Burke Nov 17 '16 at 13:14
  • i really don't know how to fix it now T_T. i wish i could just reinstall new version of ubuntu but can't. – Haruji Burke Nov 17 '16 at 13:19
  • I don't know how PHP was installed/updated. There are various ways to do that (building from sources, using some PPA, distro updating, etc), but it depends on your environment and requirements. Anyway, it's not a PHP issue. – Timurib Nov 17 '16 at 13:46
  • are you sure you restarted your apache after installing php5? this is a mandatory step when upgrading php. – LBA Nov 17 '16 at 16:50
  • I restarted but is still using php 5.4.x – Haruji Burke Nov 18 '16 at 01:48

0 Answers0