3

I have copied a new installation of CakePHP 3 to a webhotel. On my local installation it runs without problems and shows the standard startup page, but on the webhotel I get a blank page.

If I place a test.php in /webroot it displays without errors.

If I in webroot/index.php include an echo 'Show this line' just before the line with require dirname(DIR) . '/config/bootstrap.php'; it is displayed.

If I move the echo line below the require line it will not display.

So the error must be with require line.

Based on what I have found with Google I have included the following at the top in the webroot/index.php file:

ini_set('display_errors', 1);
error_reporting(E_ALL|E_STRICT);

This gives me the following error when I display the page:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /.../config/bootstrap.php on line 106

Line 106 in config/bootstrap.php looks like this:

(new ConsoleErrorHandler(Configure::read('Error')))->register();

As I wrote at the start if I run the same setup locally I don't get the error, so my guess is that I am missing a php-extension or something else on the webhotel.

As an endnote I can run CakePHP 2 without problems on the webhotel.

oschelde
  • 31
  • 1
  • 3

2 Answers2

6

It looks like your webhotel is running PHP < 5.4. CakePHP 3 requires at least PHP 5.4.16 to run correctly.

You can check the following link for a list of hosts that support PHP >= 5.4

http://phpversions.info/

0

Thank you. I missed that. Based on your comment I checked and the webhotel uses the following in the .htaccess:

AddType application/x-httpd-php56  php

and I had replaced the .htaccess on the webhotel with the .htaccess that came with CakePHP3.

oschelde
  • 31
  • 1
  • 3