HDInnovations / UNIT3D-Community-Edition

Private Torrent Tracker Built With Laravel, Livewire and AlpineJS.
GNU Affero General Public License v3.0
1.97k stars 378 forks source link

Installation Issue #58

Closed drt420 closed 6 years ago

drt420 commented 6 years ago

Hello Installation was done successfully but when I am opening site I am getting following error.

(1/1) UnexpectedValueExceptionThe stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied
--
in StreamHandler.php (line 107)
at StreamHandler->write(array('message' => 'UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main}', 'context' => array(), 'level' => 400, 'level_name' => 'ERROR', 'channel' => 'local', 'datetime' =>object(DateTime), 'extra' => array(), 'formatted' => '[2017-12-18 15:59:06] local.ERROR: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main} '))in RotatingFileHandler.php (line 107)
at RotatingFileHandler->write(array('message' => 'UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main}', 'context' => array(), 'level' => 400, 'level_name' => 'ERROR', 'channel' => 'local', 'datetime' =>object(DateTime), 'extra' => array(), 'formatted' => '[2017-12-18 15:59:06] local.ERROR: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main} '))in AbstractProcessingHandler.php (line 37)
at AbstractProcessingHandler->handle(array('message' => 'UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main}', 'context' => array(), 'level' => 400, 'level_name' => 'ERROR', 'channel' => 'local', 'datetime' =>object(DateTime), 'extra' => array(), 'formatted' => '[2017-12-18 15:59:06] local.ERROR: UnexpectedValueException: The stream or file "/var/www/html/storage/logs/laravel-2017-12-18.log" could not be opened: failed to open stream: Permission denied in /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107Stack trace:#0 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)#1 /var/www/html/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)#2 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)#3 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\\Logger->addRecord(400, Object(UnexpectedValueException), Array)#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(203): Monolog\\Logger->error(Object(UnexpectedValueException), Array)#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Log/Writer.php(114): Illuminate\\Log\\Writer->writeLog(\'error\', Object(UnexpectedValueException), Array)#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(71): Illuminate\\Log\\Writer->error(Object(UnexpectedValueException))#7 /var/www/html/app/Exceptions/Handler.php(58): Illuminate\\Foundation\\Exceptions\\Handler->report(Object(UnexpectedValueException))#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(314): App\\Exceptions\\Handler->report(Object(UnexpectedValueException))#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(118): Illuminate\\Foundation\\Http\\Kernel->reportException(Object(UnexpectedValueException))#10 /var/www/html/public/index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))#11 {main} '))in Logger.php (line 337)
at Logger->addRecord(400, object(UnexpectedValueException), array())in Logger.php (line 616)
at Logger->error(object(UnexpectedValueException), array())in Writer.php (line 203)
at Writer->writeLog('error', object(UnexpectedValueException), array())in Writer.php (line 114)
at Writer->error(object(UnexpectedValueException))in Handler.php (line 71)
at Handler->report(object(UnexpectedValueException))in Handler.php (line 58)
at Handler->report(object(UnexpectedValueException))in HandleExceptions.php (line 81)
at HandleExceptions->handleException(object(UnexpectedValueException))
HDVinnie commented 6 years ago

Give a write access to storage and cache directories

sudo chmod -R 775 /var/www/laravel/storage
sudo chmod -R 775 /var/www/laravel/bootstrap/cache

Still Not Working?

If the above steps are still not working, you can try to run the following commands in the shell:

# 1. Clear Laravel cache
php artisan cache:clear

# 2. Delete the compiled class
php artisan clear-compiled

# 3. Regenerate the composer autoload file
composer dump-autoload
drt420 commented 6 years ago

Hello I have done the above steps but still I am getting same error.

ghost commented 6 years ago

Give me the output of ls -l /var/www/laravel

drt420 commented 6 years ago

My files are under /var/www/html directory, here is the output.

root@2:~# ls -l /var/www/html
total 2376
-rw-r--r--  1 root root    3220 Dec 18 15:37 CODE_OF_CONDUCT.md
-rw-r--r--  1 root root     707 Dec 18 15:37 CONTRIBUTING.md
-rw-r--r--  1 root root     133 Dec 18 15:37 ISSUE_TEMPLATE.md
-rw-r--r--  1 root root   35147 Dec 18 15:37 LICENSE
-rw-r--r--  1 root root    5567 Dec 18 15:37 README.md
drwxr-xr-x 11 root root    4096 Dec 18 15:37 UNIT3D
-rw-r--r--  1 root root      26 Dec 18 15:37 _config.yml
drwxr-xr-x 15 root root    4096 Dec 18 15:37 app
-rwxr-xr-x  1 root root    1635 Dec 18 15:37 artisan
drwxr-xr-x  3 root root    4096 Dec 18 15:37 bootstrap
-rwxr-xr-x  1 root root 1855013 Dec 18 15:38 composer
-rwxr-xr-x  1 root root     490 Dec 18 15:37 composer-setup.sh
-rwxr-xr-x  1 root root    2151 Dec 18 15:37 composer.json
-rw-r--r--  1 root root  196471 Dec 18 15:37 composer.lock
drwxr-xr-x  2 root root    4096 Dec 18 15:56 config
drwxr-xr-x  5 root root    4096 Dec 18 15:37 database
-rw-r--r--  1 root root  246247 Dec 18 15:37 package-lock.json
-rwxr-xr-x  1 root root    1050 Dec 18 15:37 package.json
-rwxr-xr-x  1 root root    1026 Dec 18 15:37 phpunit.xml
drwxr-xr-x  8 root root    4096 Dec 18 15:37 public
drwxr-xr-x  4 root root    4096 Dec 18 15:37 resources
drwxr-xr-x  2 root root    4096 Dec 18 15:37 routes
-rwxr-xr-x  1 root root     566 Dec 18 15:37 server.php
drwxrwxrwx  5 root root    4096 Dec 18 15:37 storage
drwxr-xr-x 50 root root    4096 Dec 18 15:39 vendor
-rwxr-xr-x  1 root root     555 Dec 18 15:37 webpack.mix.js

I think chmod 777 did the trick but still getting following error.

(1/1) RuntimeExceptionThe only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
--
in Encrypter.php (line 43)
at Encrypter->__construct('', 'AES-256-CBC')in EncryptionServiceProvider.php (line 27)
at EncryptionServiceProvider->Illuminate\Encryption\{closure}(object(Application), array())in Container.php (line 726)
at Container->build(object(Closure))in Container.php (line 608)
ghost commented 6 years ago

Run: php artisan key:generate

drt420 commented 6 years ago

I have already generated key but still getting same error.

ghost commented 6 years ago

What's the output of php artisan key:generate?

drt420 commented 6 years ago

Output is as below

root@2:/var/www/html# php artisan key:generate
Application key EDIT: REMOVED set successfully.
HDVinnie commented 6 years ago

just make sure the output matches what was written to the .env

if not paste your {YOUR APP KEY} into the .env under APP_KEY

ghost commented 6 years ago

Yeah, have you made an .env file?

HDVinnie commented 6 years ago

Also I'm assuming since you posted your app key here your install for UNIT3D is for demo purposes only and not production. Never share your app key.

drt420 commented 6 years ago

I regenerated the key, .env output is as below. Yes, it a demo only once I am finish with testing I will start prod server.

APP_ENV=local
APP_KEY=YOUR_APP_KEY
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_LOG=daily
APP_URL=http://127.0.0.1

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=nbt
DB_USERNAME=root
DB_PASSWORD=Oct@2014

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=Oct@2014
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_NAME=

DEFAULT_OWNER_NAME=UNIT3D
DEFAULT_OWNER_EMAIL=unit3d@none.com
DEFAULT_OWNER_PASSWORD=UNIT3D
ghost commented 6 years ago

I've changed the APP_URL to http://127.0.0.1 and removed the APP_KEY as it might have contained sensitive data.

HDVinnie commented 6 years ago

in your env delete the key after APP_KEY=

Push new env to server. Then run php artisan key:generate

make sure new output matches env. If so and still error make sure /config/app.php line 117-119 looks like so

    'key' => env('APP_KEY'),

    'cipher' => 'AES-256-CBC',
drt420 commented 6 years ago

Still same error, do you have skype where we can discuss more about it

HDVinnie commented 6 years ago

you can join https://discord.gg/T2YPNPZ and visit the #support channel

cbj4074 commented 6 years ago

EDIT: My colleague has informed me that my previous remark was irrelevant, because the key had been removed for privacy. "Mah bad!"

@drt420 What is the output of stat .env? It seems clear that your .env is present, the key is set, yet it can't be read. The most obvious reason for this is that you were operating as the root user and did something like cp env.example .env, but your web-server is not running as root (thank goodness). This might also explain your earlier troubles with the storage directories.

Also, setting permissions to 777 is (almost) never the answer. If the site is connected to the Internet at all, that will bite you. You should use 750, 770, or 775, depending, but never 777. If using 777 is the only way it works, then the user and/or group should be adjusted instead. Maybe you are working locally, and you don't care; just figured I would mention it.

HDVinnie commented 6 years ago

@drt420 any updates? Can I close this?

drt420 commented 6 years ago

This has been resolved, Thanks for all the support