Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Eduardo's avatar

[SOLVED] [L5] New: Can't display errors, 500 internal server error

Hi to everyone, I'm new here.

I've set up a new app using laravel, that is working, but every time something is not working I'm getting a Blank page.

For example, the WelcomeController, method index() works correctly, if i do an echo 'Hi'; die; I get 'Hi', but if i write something wrong like function_unkown();, i get nothing, but if i do the same in the public/index.php, errors are showing.

I've setup my .env file with:

APP_ENV=local APP_DEBUG=true

But nothing.

Anyone knows what might be happening.

Any tip or ideas are appreciated.

Thanks to everyone.

0 likes
28 replies
bashy's avatar
  • Got any error settings in virtual host config?
  • Does it work for plain PHP file with error?
  • Got Xdebug installed?
  • What is the http status code of the blank page?
1 like
willvincent's avatar

@andy the issue is that he's not seeing errors at all not that he's not seeing useful or pretty errors. ;)

kingpabel's avatar

Did you give your tmp folder 777 permission? Or delete storage/meta/compiled.php file. or try " 'php artisan optimize' in your app's directory

Eduardo's avatar

Hi, to everyone for answering.

@bashy

Got any error settings in virtual host config? error_reporting(-1), display_error = On Does it work for plain PHP file with error? It works, but as i said before, if i write anything wrong inside the controller, i get only a blank page Got Xdebug installed? No What is the http status code of the blank page? 500 Internal Server Error

@willvincent I see nothing :(

@kingpabel I will check

I will check the status code, it seems that something wrong is happening, since i get an status code 500.

sitesense's avatar

I noticed a similar problem some time ago when hhvm was enabled.

Try disabling it or remove it from Homestead.yaml:

hhvm: false
1 like
bashy's avatar

Check log files for web server (Apache/Nginx) and PHP. Also anything in Laravel's log file?

You also haven't said what your web server setup is. Homestead? WAMP? XAMPP? Apache/Nginx?

alenabdula's avatar

the WelcomeController, method index() works correctly, if i do an echo 'Hi'; die; I get 'Hi', but if i write something wrong like function_unkown();, i get nothing

I might be reading this wrong or I've must have hit my head pretty hard yesterday snowboarding but isn't this expected behavior?

You can't create "Unknown Function" as a method, that doesn't make sense.

but if i do the same in the public/index.php, errors are showing.

Because the code is being executed procedurally.

ETA:

Can you show us some code? Try adding this to your routes.php file:

Route::resource('demo', 'DemoController');

And visit /demo, do you see any errors now? Something along the lines of DemoController not found.

bashy's avatar

They probably mean normal PHP errors.

willvincent's avatar

@alenabdula I took it to mean, something like this inside the welcome controller:

// This works
public function index() {
  echo "Hi";
  die();
}
// This doesn't work, obviously, but does not display any errors either.
public function index() {
  foo_bar_baz() // Call to non-existent function, should make php blow up.
}
// results in blank page, NOT error message as expected.

The latter should result in a FatalErrorException Call to undefined function App\Http\Controllers\foo_bar_baz() (it does for me)

@Eduardo Perhaps your env file isn't being read for some reason. Try manually setting debug mode to true within config/app.php

// Update to this:
'debug' => true, //env('APP_DEBUG'),

But, if @alenabdula is correct and rather than your unknown_function() being within the index method, but instead being created as a different method, that's not going to cause an error since it wouldn't be getting called. That seems fairly obvious though.

alenabdula's avatar

That seems fairly obvious though.

@willvincent I guess I was thrown off by "I'm new here" thinking OP is a beginner with Laravel so what seems so obvious to us, might be difficult for them. Idk. @Eduardo can you elaborate little bit, show us some code examples maybe...?

Eduardo's avatar
Eduardo
OP
Best Answer
Level 1

Hi to everyone, I've just finished fixing my laravel setup.

First of all, a newbie mistake, sorry!

I enabled logging, but my storage folder wasn't writable, so i got an exception because Laravel could not log anything.

I've found the error following this answer: http://stackoverflow.com/a/21286637 After that, it was very obvious.

Some things I don't understand:

  • Why Laravel turns off display_errors by default when 'debug' is set to true.
  • Why there's no warning telling you that folder x must be writable (I imagine that you can choose where do you want to save your logs), showing you a pretty message on screen.

Thanks to all !!

@willvincent @alenabdula @bashy @sitesense @kingpabel @andy

I've just marked this post as [SOLVED], maybe it will help somebody, someday.

7 likes
RomainLanz's avatar

@Eduardo You can select your answer to be the correct one. Your post would be automatically solved.

bashy's avatar

Another person not following the configuration guide :)

Also on your dev server you should have PHP to display errors, maybe Xdebug as well?

Eduardo's avatar

@bashy

As i mentionned before, my php.ini is configured to display errors, but laravel overrides that configuration, hidding the errrors, so i wasn't able to see the exception, telling me that the folder storage wasn't writtable. Easy to debug if it wasn't for that.

bashy's avatar

@Eduardo I use Xdebug so that could differ. Also you would be checking error logs for web server? There should always be some sort of way to see them even if Laravel overrides the displaying of them on the page.

jjjda's avatar

sitesense's answer solved it for me also when using Homestead: "

I noticed a similar problem some time ago when hhvm was enabled.

Try disabling it or remove it from Homestead.yaml: hhvm: false

"

mail2nisam's avatar

We need to care about the Directory permission and ownership. For solving this problem we have to set the app directory permission to 777

sudo chmod 755 -R {app_directory}

And change the ownership of the /storage directory too

chmod -R o+w {app_directory}/storage

2 likes
sebastiangperez's avatar

I got the same problem , but solved using 777 .... but i think 775 is the proper permision but dont work using that.

seaham's avatar

before trying out all the complex solutions, try these inside your laravel application: chmod -R o+w storage/

itstyro's avatar

Hi guys !!

I haven't been through all the comments. But doing following helped me to resolve the similar issue.

I used Log::debug statements in my API handler. But Lumen didn't have permission to write logs in log file. I just gave the appropriate permissions and server started responding with desired result.

hope this might help somebody

NickVahalik's avatar

Like some of you, I ran into this problem last night. My problem was that I put a Log::debug() call inside of the HTTP kernel and I was getting a weird "Uncaught RuntimeException: A facade root has not been set." error. However, upon removing these statements the issue went away and everything was working again.

sdevilcry's avatar

Got the same issue.. Everything is logged, I try to play with Service provider, no more exception, trace, error info..

I found this shitty line:

       if (! $app->environment('testing')) {
            ini_set('display_errors', 'Off');
        }

Why ? As developer, I want to see everything.

Is it somewhere else a setting problem ?

ansarhusain's avatar

Just update one line at the location

laravel/config/app.php -> 'env' => 'production', to 'env'=>'testing'

or 'env' => env('APP_ENV', 'production') to 'env' => env('APP_ENV', 'testing')

it will display all errors.

1 like

Please or to participate in this conversation.