Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation Issue #58

Closed
drt420 opened this issue Dec 18, 2017 · 19 comments
Closed

Installation Issue #58

drt420 opened this issue Dec 18, 2017 · 19 comments

Comments

@drt420
Copy link

drt420 commented Dec 18, 2017

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
Copy link
Collaborator

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
Copy link
Author

drt420 commented Dec 18, 2017

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

@ghost
Copy link

ghost commented Dec 18, 2017

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

@drt420
Copy link
Author

drt420 commented Dec 18, 2017

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
Copy link

ghost commented Dec 18, 2017

Run: php artisan key:generate

@drt420
Copy link
Author

drt420 commented Dec 18, 2017

I have already generated key but still getting same error.

@ghost
Copy link

ghost commented Dec 18, 2017

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

@drt420
Copy link
Author

drt420 commented Dec 18, 2017

Output is as below

root@2:/var/www/html# php artisan key:generate
Application key EDIT: REMOVED set successfully.

@HDVinnie
Copy link
Collaborator

HDVinnie commented Dec 18, 2017

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
Copy link

ghost commented Dec 18, 2017

Yeah, have you made an .env file?

@HDVinnie
Copy link
Collaborator

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
Copy link
Author

drt420 commented Dec 18, 2017

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
[email protected]
DEFAULT_OWNER_PASSWORD=UNIT3D

@ghost
Copy link

ghost commented Dec 18, 2017

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
Copy link
Collaborator

HDVinnie commented Dec 18, 2017

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
Copy link
Author

drt420 commented Dec 18, 2017

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

@HDVinnie
Copy link
Collaborator

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

@cbj4074
Copy link
Contributor

cbj4074 commented Dec 19, 2017

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
Copy link
Collaborator

@drt420 any updates? Can I close this?

@drt420
Copy link
Author

drt420 commented Dec 20, 2017

This has been resolved, Thanks for all the support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants