kuchar kuchar - 1 month ago 15
Linux Question

Laravel error 500 when upload changes to template file

I build laravel project on my remote server, everything works ok but when i saved any changes for example on

resources/views/welcome.blade.php
i cant get in to this default route, browser tells me it is
HTTP ERROR 500
.

And it is same with all files that i changed on server. If i typed
php artisan serve --host 0.0.0.0
in console and go to
192.168.1.4:8000/
every thing works again until again i will saves something new...

I have this issue on fresh laravel project without any changes.
My file permisions:

drwxr-sr-x 13 kuchar www-data 4096 Oct 25 09:11 ./
drwxr-sr-x 3 kuchar www-data 4096 Oct 25 08:27 ../
-rw-r--r-- 1 kuchar www-data 542 Oct 25 08:30 .env
-rw-r--r-- 1 kuchar www-data 491 Oct 25 08:27 .env.example
drwxr-sr-x 8 kuchar www-data 4096 Oct 25 09:13 .git/
-rw-r--r-- 1 kuchar www-data 61 Oct 25 08:27 .gitattributes
-rw-r--r-- 1 kuchar www-data 95 Oct 25 08:27 .gitignore
drwxr-sr-x 6 kuchar www-data 4096 Oct 25 08:27 app/
-rw-r--r-- 1 kuchar www-data 1646 Oct 25 08:27 artisan
drwxr-sr-x 3 kuchar www-data 4096 Oct 25 08:27 bootstrap/
-rw-r--r-- 1 kuchar www-data 1283 Oct 25 08:27 composer.json
-rw-r--r-- 1 kuchar www-data 124085 Oct 25 08:27 composer.lock
drwxr-sr-x 2 kuchar www-data 4096 Oct 25 08:27 config/
drwxr-sr-x 5 kuchar www-data 4096 Oct 25 08:27 database/
-rw-r--r-- 1 kuchar www-data 560 Oct 25 08:27 gulpfile.js
-rw-r--r-- 1 kuchar www-data 402 Oct 25 08:27 package.json
-rw-r--r-- 1 kuchar www-data 930 Oct 25 08:27 phpunit.xml
drwxr-sr-x 4 kuchar www-data 4096 Oct 25 08:27 public/
-rw-r--r-- 1 kuchar www-data 1918 Oct 25 08:27 readme.md
drwxr-sr-x 5 kuchar www-data 4096 Oct 25 08:27 resources/
drwxr-sr-x 2 kuchar www-data 4096 Oct 25 08:27 routes/
-rw-r--r-- 1 kuchar www-data 563 Oct 25 08:27 server.php
drwxr-sr-x 5 kuchar www-data 4096 Oct 25 08:27 storage/
drwxr-sr-x 2 kuchar www-data 4096 Oct 25 08:27 tests/
drwxr-sr-x 31 kuchar www-data 4096 Oct 25 08:29 vendor/
-rw-r--r-- 1 kuchar www-data 147055 Oct 25 08:27 yarn.lock


and virtualhost settings:

<VirtualHost *:80>
ServerName laravel-project.domain
DocumentRoot "/laravel-project/public"

<Directory "/laravel-project/public">
AllowOverride all
</Directory>
</VirtualHost>


To this project i go with domain
laravel-project.domain
through apache,
artisan serve
use only when error 500 apper

Edit>
Also i try to type command like:

php artisan view:clear
php artisan route:clear
php artisan route:cache
php artisan cache:clear
php artisan config:cache
php artisan config:clear


Nothing works :( only
php artisan serve

Answer

Lets focus on errors first since they're more important:

  1. PHP doesn't have logging errors enabled

    • Make sure that error_logging in php.ini is enabled.
  2. Apache can't read/write its own error log. Which is odd but still, make sure that the permissions are all ok.

    • If you have more than 1 version of php installed do which php and make sure that the PATH and other such things are ok.

Laravel also has some folders that it will whine about if they don't have permissions, namely storage/*.

Make sure that apache has permissions to read/write anything that is in that folder.

And also make sure that the owner group for those files is apache.

Hope it helps.

Comments