Home » Php » php – CakePHP showing blank page

php – CakePHP showing blank page

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have a website that is finished and uploaded, at first it works fine but after a while it stops working.

By stops working I mean whatever page I go to just shows a blank page, empty source.

In Chrome though, I get HTTP Error 500 (Internal Server Error)

To fix this all I need to do is change debug to 2, refresh and then change it back to 0.

I do not know what triggers this to happen, I have tried clearing the cache folders.

There are no log entries in /app/tmp/logs/error from the last week.

Any ideas would be great. Thanks.

How to&Answers:

In the end it was APC cache conflicts between multiple Cakes on the same server.

All I had to do was change $prefix in config.php and it worked.

Answer:

Cakephp can show also blank page, if you have some component included in your controller and it contains error, and if for some reason debug does not work(though debug level in core.php is 2 or 3 ) in your component , it just shows blank page.

Answer:

this post is getting old, but today I upload a new website to a server and get the blank page so I share my experience. I have no access to server logs so I was stuck. I was very confused because that server has running another sites with cakephp so I think the problem was mod_rewrite. After several ours of testing the problem was that the server’s php version was too old to run cake 2.8.3. so I use an older version of cake and everything works fine. Hope this help someone.

Answer:

Happened to me when I had a constant defined, did not notice this and defined another one with the same name.

const VISIBLE = 1;
const DELETED = 0;
const VISIBLE = 1;

A few years later I will add a comment here:

This would mean there was a syntax error, make sure u display these.

Answer:

It might be due to white space in end of file
Please check your all files if white space is there after ‘?>’ tag it redirects it to blank page
or you can remove ‘?>’(closing php tag) to remove this problem.

Answer:

In my case i had

public function appError($error) {}

on AppController which was supposed to redirect to a 404 page and i commented the redirect. this led to me having blank page.

Answer:

I had the exact same problem, it was the folder app/tmp/cache/models that didn’t exist. After creating it, no more problem.

Answer:

In my case the problem was not the cache.
Enabling CakePHP debug should be useful. Change the value to

Configure::write('debug', 0);

to

Configure::write('debug', 1);

in app/cake/core.php
to show the real errors.