Blank page after installing CakePHP 3

余生长醉 提交于 2019-12-23 21:15:32

问题


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.


回答1:


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/




回答2:


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.



来源:https://stackoverflow.com/questions/28817687/blank-page-after-installing-cakephp-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!