How to see PHP error stack trace/dump?
Solution 1
Can you post the contents of php.ini? This looks like a configuration issue. We will need to check that the web server can find the error log you defined in php.ini and that the web server has permissions to write to it. PHP silently fails if either condition isn't met...
Solution 2
Open the php.ini file and change the following directives so it looks like this.
display_errors = On
error_reporting = E_ALL
Then restart Apache and do something to cause an error, such as manually call trigger_error('Test');
on a page.
You should be aware this is bad practice for a production website. These settings are fine in dev, where you want errors to be blatantly obvious, but for production you should be logging errors to a file which you review. This log file is defined with the error_log
directive.
Related videos on Youtube
Arno
Updated on September 18, 2022Comments
-
Arno over 1 year
I'm trying to work with Laravel 5 on NetBeans.
Now, I'm trying tovar_dump
through Laravel 5 to understand how the application works, and I keep getting 500 errors when I have even a simple syntax error in my code, and it doesn't output the error log like normally. From what I understand by research is that it's caused by Laravel not being able to write into/storage/
folder in Laravel.
I created a new groupnetbeans
and addedwww-data
user to it, so right now I'm trying to figure out how do you install it so that Laravel 5 and NetBeans could 'recognize' each other. Right now I have NetBeans installed withapt-get install
, and now that I've changed the Laravel 5 project rights with:
chown -R www-data:netbeans laravel5/
Now I can't access Laravel's project files with NetBeans because of right issues. All this is sort of confusing to me, so my question is:How do I properly setup NetBeans and Laravel so I could edit my Laravel project folders files and somehow have Laravel access
/storage/
folder inside Laravel, so I would not see 500 error and a blank page on every syntax error I make?P.S: I tried to be as precise and explanatory as I could be
-
Nam G VU over 12 yearsIt's great. I think I better go with the
error_log
option. -
Nam G VU over 12 yearsI tried to alter my php.ini at
/etc/php5/apache2/php.ini
to includeerror_log = php_errors.log
,display_errors = On
,error_reporting = E_ALL
; then I restart Apache viasudo /etc/init.d/apache2 restart
. Then I refresh the error page: I can see the error printed on my web but I found no lines in/etc/php5/apache2/php_errors.log
. Please help -
thinice over 12 yearsThe error in your page is identical to what you'd get in the error log anyways.
-
Nam G VU over 12 yearscode.namgivu.com/index-phpinfo.php is my
phpinfo
-
Mina over 12 yearsYou're not specifying an absolute path to the error log. This means that the webserver will asume that the error log is in document_root. (Someone correct me if I'm wrong)Try putting in path to the apache logs dir, restarting the server, and see if you get output.
-
Nam G VU over 12 years@Mideiane I appreciate your help a lot. Though, if it were with more full information, I'll choose your answer as accepted. Thank you a lot! It's now works with full path.
-
Mina about 12 years@NamGiVU hm. OK.
-
Arno over 8 yearswell I've tried it, and it still outputs a 500 Server Error whenever I do an error in the code. I'll still search upon that later, right now I just want to figure out what is the deal with the users and to set them up to sync
-
davejal over 8 yearsdid you set APP_DEBUG in .env to true
-
davejal over 8 yearsI aslo edited my answer with info on 500 error because of permissions to the log folder
-
Arno over 8 yearsI tried what you suggested with the 777 for the whole project folder. And I set APP_DEBUG to true in
env/app.php
, I still get 500 when I do an error in my code