Error on wrong artisan command - laravel-5

I know whenever someone types wrong artisan command a well-formatted error message is shown
But there is some problem in my project because when I run wrong command eg
php artisan create:migration create_table
I am getting this output
PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/amarjit/Documents/localhost/inkpothub/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)
#3 /home/amarjit/Documents/localhost/inkpothub/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)
#4 /home/amarjit/Documents/localhost/inkpothu in /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
PHP Fatal error: Uncaught UnexpectedValueException: The stream or file "/home/amarjit/Documents/localhost/inkpothub/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Logger.php(337): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Logger.php(616): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)
#3 /home/amarjit/Documents/localhost/inkpothub/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorExcept in /home/amarjit/Documents/localhost/inkpothub/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 107
its only happening with one of my Laravel-5.3 project. Therefore the issue is not related with my localhost

Related

How to resolve error on ProcessMaker 4.3.0 instllation?

My server specifications:
Centos 7.9
PHP 8.2
Nginx
MySQL 8.0
Composer 2.4.4
Node 16.18.1
NPM 8.19.3
Redis 5
Docker
I have installed all the dependencies required for ProcessMaker 4.3.0 running(mentioned the versions above). After enabling the npm, laravel and artisan horizan server, I hit the URL and get 500 error. On checking the nginx log I get the following error:
[error] 8150#8150: *512 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/opt/processmaker-4.3.0/storage/framework/views/ef0f3565ae74afa67f42e441ee3da8cfbe934ae1.php): Failed to open stream: Permission denied in /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(187): file_put_contents() #2 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(169): Illuminate\Filesystem\Filesystem->put() #3 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(55): Illuminate\View\Compilers\BladeCompiler->compile() #4 /opt/processmaker-4.3.0/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get() #5 /opt/processmaker-4.3.0/vendor/laravel/fram...PHP message: PHP Fatal error: Uncaught ErrorException: file_put_contents(/opt/processmaker-4.3.0/storage/framework/views/ef0f3565ae74afa67f42e441ee3da8cfbe934ae1.php): Failed to open stream: Permission denied in /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:187 Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() #1 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(187): file_put_contents() #2 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(169): Illuminate\Filesystem\Filesystem->put() #3 /opt/processmaker-4.3.0/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(55): Illuminate\View\Compilers\BladeCompiler->compile() #4 /opt/processmaker-4.3.0/vendor/facade/ignition/src/Views/Engines/CompilerEngine.php(37): Illuminate\View\Engines\CompilerEngine->get
I have already given 755 permission to the storage and vendor folder in processmaker. Also the owner ship and group of all the folders and files is nginx.
Whatelse, could I be missing out?

Symfony Composer error when i try to lunch symfony

When I launch a symfony project I get this error, I have already deleted and installed the composer but nothing changes.
PHP Fatal error: Uncaught PharException: internal corruption of phar "C:\Webtech\composer.phar" (__HALT_COMPILER(); not found) in C:\Webtech\composer.phar:28
Stack trace:
#0 C:\Webtech\composer.phar(28): Phar::mapPhar('composer.phar')
#1 {main}
thrown in C:\Webtech\composer.phar on line 28
Fatal error: Uncaught PharException: internal corruption of phar "C:\Webtech\composer.phar" (__HALT_COMPILER(); not found) in C:\Webtech\composer.phar:28
Stack trace:
#0 C:\Webtech\composer.phar(28): Phar::mapPhar('composer.phar')
#1 {main}
thrown in C:\Webtech\composer.phar on line 28```

Composer fails on capistrano deploy "phpseclib/bootstrap.php: failed to open stream"

So, running cap production deploy now fails and gives me this log:
DEBUG [d8e9f9b4] Generating autoload files
DEBUG [d8e9f9b4] > Illuminate\Foundation\ComposerScripts::postInstall
DEBUG [d8e9f9b4] PHP Warning: Uncaught ErrorException: require(/some_path/releases/20161101100659/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /some_path/releases/20161101100659/vendor/composer/autoload_real.php:55
Stack trace:
#0 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(55): Composer\Util\ErrorHandler::handle(2, 'require(/srv/us...', '/path/...', 55, Array)
#1 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(55): require()
#2 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(45): composerRequire28a339249b76e8c9bd2081b3b12636da('decc78cc4436b12...', '/path/...')
#3 /some_path/releases/20161101100659/vendor/autoload.php(7): ComposerAutoloaderInit28a339249b76e8c9bd2081b3b12636da::getLoader()
#4 /some_path/releases/201611011006 in /some_path/releases/20161101100659/vendor/composer/autoload_real.php on line 55
DEBUG [d8e9f9b4]
Warning: Uncaught ErrorException: require(/some_path/releases/20161101100659/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /some_path/releases/20161101100659/vendor/composer/autoload_real.php:55
Stack trace:
#0 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(55): Composer\Util\ErrorHandler::handle(2, 'require(/path/...', '/path/...', 55, Array)
#1 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(55): require()
#2 /some_path/releases/20161101100659/vendor/composer/autoload_real.php(45): composerRequire28a339249b76e8c9bd2081b3b12636da('decc78cc4436b12...', '/path/...')
#3 /some_path/releases/20161101100659/vendor/autoload.php(7): ComposerAutoloaderInit28a339249b76e8c9bd2081b3b12636da::getLoader()
#4 /some_path/releases/201611011006 in /some_path/releases/20161101100659/vendor/composer/autoload_real.php on line 55
DEBUG [d8e9f9b4] PHP Fatal error: composerRequire28a339249b76e8c9bd2081b3b12636da(): Failed opening required '/some_path/releases/20161101100659/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/opt/sp/php7.0/lib/php') in /some_path/releases/20161101100659/vendor/composer/autoload_real.php on line 55
DEBUG [d8e9f9b4]
Fatal error: composerRequire28a339249b76e8c9bd2081b3b12636da(): Failed opening required '/some_path/releases/20161101100659/vendor/phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/opt/sp/php7.0/lib/php') in /some_path/releases/20161101100659/vendor/composer/autoload_real.php on line 55
It worked fine before I changed JWT lib from 0.5.9 to 1.0.0.alpha and added laravelconnect/remote package.
Note: this all works on my local machine. I've no idea why phpsec doesn't have bootstrap.php file in it. On my local machine it does have it.

Laravel nginx permission issue

I've installed laravel on nginx based on this tutorial
. when i run my server ip address a blank page appears.
this is nginx error log:
2016/09/15 12:40:59 [error] 2857#0: *1 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(336): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Logger.php(615): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)
#3 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(202): Monolog\Logger->error(Object(UnexpectedValueException), Array)
#4 /var/www/laravel/vendor/laravel/framework/src/Illuminate/Log/Writer.php(113): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueEx...
PHP message: PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/laravel/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:107
Stack trace:
#0 /var/www/laravel/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
I did have the same problem with this command: php artisan storage:link, and I did resolved with the command sudo before the code. Like this:
'sudo php artisan storage:link'. I believe that if you use sudo you will no longer have this problem.

Bugsnag error when running artisan command

I got this error when trying to run my php artisan migrate on my production server...
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
PHP Fatal error: Uncaught exception 'Exception' with message 'Bugsnag Error: Invalid API key' in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php:19
Stack trace:
#0 /var/app/current/vendor/bugsnag/bugsnag-laravel/src/Bugsnag/BugsnagLaravel/BugsnagLaravelServiceProvider.php(61): Bugsnag_Client->__construct(NULL)
#1 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(738): Bugsnag\BugsnagLaravel\BugsnagLaravelServiceProvider->Bugsnag\BugsnagLaravel\{closure}(Object(Illuminate\Foundation\Application), Array)
#2 /var/app/current/vendor/laravel/framework/src/Illuminate/Container/Container.php(631): Illuminate\Container\Container->build(Object(Closure), Array)
#3 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('bugsnag', Array)
#4 /var/app/current/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php(62): Illuminate\Foundation\Application->make('bugsnag', Array)
#5 /var/app/current/vendor/bugsnag/bugsna in /var/app/current/vendor/bugsnag/bugsnag/src/Bugsnag/Client.php on line 19
I ran env on the command line and I have an env variable called BUGSNAG_API_KEY and the value of it exactly matches the key at bugsnag.com for this project.
Furthermore, I have this line in my project at ./config/bugsnag.php
'api_key' => env('BUGSNAG_API_KEY'),
Weirdly, I eventually tried the same command again (php artisan migrate) and it worked! But it's left me very unsettled as it's a production server. So I'd like to understand the problem.
Errors seem to be logging in Bugsnag as well by the way.
Try to regenerate the configuration cache with php artisan config:cache. It will use the current data from the .env file to generate a new configuration cache. This worked for me.
In case this helps anyone...
The Bugsnag Git Repo mentions this issue:
(Uncaught exception 'ReflectionException' with message 'Class bugsnag.logger does not exist'
Github user GrahamCampbell suggested that what is actually happening is that another error exists, but it's "...trying to log to bugsnag which is causing this error, which is hiding the real error". I confirmed this was my issue by doing what user russianryebread suggested, which was to manually copy the bugsnag.php config file over to the Laravel /config directory. Once I did that now my real error shows:
[Symfony\Component\Debug\Exception\FatalThrowableError] Parse error: syntax error, unexpected '{'
Now to troubleshoot this issue :)
Hope this helps!

Resources