2

When my code have error (even syntax errors) browser show 500 - Internal Server Error, In .env I set the APP_DEBUG to true and APP_LOG_LEVEL is debug

How can I enable error messages?

UPDATE:

I use Laravel 5.3

UPDATE 2:

I use Apache and defined VirtualHost to access this app :

<VirtualHost *:80>
    ServerAdmin myemail@domain.com
    DocumentRoot "/Dev/Web/site/public"
    ServerName site.local
    ServerAlias www.site.local
    ErrorLog "/private/var/log/apache2/site.local-error_log"
    CustomLog "/private/var/log/apache2/site.local-access_log" common

    <Directory "/Dev/Web/site/public/">
        Require all granted
        AllowOverride All
    </Directory>
</VirtualHost>

UPDATE 3:

My /etc/hosts records:

# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost gat.local www.gat.local site.local www.site.local shop.local www.shop.local
MajAfy
  • 3,007
  • 10
  • 47
  • 83

3 Answers3

2

Short answer you can't. Why?

Simply because 500 - Internal Server Error is exactly what it says Internal Server Error, it has nothing to do with Laravel. Server software (Apache in your case) causes error 500. Most likely permissions problem. (server software can not read / write to certain files etc.)

From Laravel documentation:

After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run.

You have to check Apache logs

Default on OSX machine /private/var/log/apache2


You want to see more errors? Follow up this SO thread.


Neat trick, make sure to have one entry per project in your hosts file.

#127.0.0.1 project1.dev www.project1.dev
#127.0.0.1 project2.dev www.project2.dev
.
.
.

Why? You can just comment out / delete line, searchable, easier to read.

Community
  • 1
  • 1
Kyslik
  • 8,217
  • 5
  • 54
  • 87
  • Thanks for your answer, Yes you right, but it's very strange because for syntax errors (for example missing semicolons) I am still Internal Server error ! – MajAfy Oct 09 '16 at 06:55
  • @MajAfy read contents of provided link to another SO thread, that may solve your problem. – Kyslik Oct 09 '16 at 07:21
0

@MajAfy You can use barryvdh/laravel-debugbar. This will give you in depth knowledge of every error. What query you are running and lot more.

Here is the link https://github.com/barryvdh/laravel-debugbar .

Its easy to install due to its well documentation.

Manish
  • 3,443
  • 1
  • 21
  • 24
  • Thanks but I need simple error for some syntax errors, I don't know why laravel does not show these errors! – MajAfy Oct 08 '16 at 12:44
-2

After many tries, I found problem,

Everything return to file permissions,

I changed the permission of laravel.log in storage/logs to 777 and everything work fine !

MajAfy
  • 3,007
  • 10
  • 47
  • 83