I tried to install phpMyAdmin on a customers webserver. Suddenly I get this error:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /homepages/29/d104628985/htdocs/*****-*****/phpMyAdmin/index.php on line 53

I did not change anything in the files of phpMyAdmin. At last I found that somebody deleted the php.ini from the directory. Can be this the reason for the error?

This is the block with line 53 (the sixth line).

require_once 'libraries/RecentTable.class.php';
if ($GLOBALS['is_ajax_request'] && ! empty($_REQUEST['recent_table'])) {
$response = PMA_Response::getInstance();
  • 1
    What version of PHP is on the customers webserver? – MrWhite Dec 10 '15 at 13:36
  • This question saved my day! I solved my problem, on the customers server PHP 4.2 was the default. I changed it with .htaccess to PHP 5 and now it works! Thanks! – preissy Dec 10 '15 at 14:36
  • You can add that as an answer (and accept it). I was thinking it was perhaps a PHP version-thing for it to be a "parse error", and there has been some changes in PHP 5.4 with respect to the "arrow" operator. However, AFAIK the above should work in all versions of PHP 5.x, so... PHP 4.2 - wow! :) – MrWhite Dec 10 '15 at 14:53

I suspected this was caused by running a (very) old version of PHP. (It seems PHP 4.2 was installed on the server).

The reported "Parse error" is a fundamental syntax error at compile time. Any other problems such as libraries not being found or errors during object instantiation (at runtime) would have resulted in different errors/warnings. However, there is nothing syntactically wrong with the above code in PHP5.

It would seem that calling a method directly on a function's return value is not supported in PHP4's OOP model*. (In fact, there have been further improvements with respect to the object/arrow operator in PHP 5.4, allowing methods to be called directly on object instantiation.)

*Although I can't find specific mention of this as a "new feature" in the PHP5 changelog.

| improve this answer | |

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.