Laravel Tinker: Class 'Psy\Exception\ErrorException' not found - php

I'm trying to run Laravel 5.5 tinker but get an exception when i try to run the factory Command. For example:
factory(App\Article::class, 100)->create();
When i try to run lets say the User:class command in another repository it works without any problems.
PHP error: Class 'Psy\Exception\ErrorException' not found in /Users/sebastian/Development/app.manager/vendor/psy/psysh/src/Psy/Shell.php on line 812
Extended Error-Message:
PHP warning: opendir(/Users/sebastian/Development/app.manager/database/factories): failed to open dir: Too many open files in /Users/sebastian/Development/app.manager/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php on line 145
PHP Warning: Uncaught Psy\Exception\ErrorException: PHP warning: require(/Users/sebastian/Development/app.manager/database/factories/ArticleFactory.php): failed to open stream: Too many open files in /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php on line 202 in /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php:202
Stack trace:
#0 /Users/sebastian/Development/app.manager/vendor/psy/psysh/src/Psy/Shell.php(809): Psy\Exception\ErrorException::throwException(2, 'require(/Users/...', '/Users/sebastia...', 202)
#1 /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php(202): Psy\Shell->handleError(2, 'require(/Users/...', '/Users/sebastia...', 202, Array)
#2 /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php(202): require()
#3 /Users/sebastian/Development/app.manager/vendor/laravel/framework in /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php on line 202
PHP Fatal error: Illuminate\Database\Eloquent\Factory::load(): Failed opening required '/Users/sebastian/Development/app.manager/database/factories/ArticleFactory.php' (include_path='.:') in /Users/sebastian/Development/app.manager/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php on line 202
PHP Fatal error: Uncaught Psy\Exception\ErrorException: PHP warning: include(/Users/sebastian/Development/app.manager/vendor/symfony/debug/Exception/FatalErrorException.php): failed to open stream: Too many open files in /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php on line 444 in /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php:444
Stack trace:
#0 /Users/sebastian/Development/app.manager/vendor/psy/psysh/src/Psy/Shell.php(809): Psy\Exception\ErrorException::throwException(2, 'include(/Users/...', '/Users/sebastia...', 444)
#1 /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php(444): Psy\Shell->handleError(2, 'include(/Users/...', '/Users/sebastia...', 444, Array)
#2 /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php(444): include()
#3 /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/Users/sebastia...')
#4 [internal function]: Composer\Autoload\ClassLoader->loadClass('Sym in /Users/sebastian/Development/app.manager/vendor/composer/ClassLoader.php on line 444
What I've alrdy tried:
removing and re-ading the laravel/tinker from composer.json

Related

I got a fatal error when I went to install Open Web Analytics

Fatal error: Uncaught UnexpectedValueException: The stream or file "/var/www/html/owa/owa-data/logs/errors_d41d8cd98f00b204e9800998ecf8427e.txt" could not be opened in append mode: failed to open stream: Permission denied in /var/www/html/owa/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:146 Stack trace: #0 /var/www/html/owa/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(48): Monolog\Handler\StreamHandler->write() #1 /var/www/html/owa/vendor/monolog/monolog/src/Monolog/Logger.php(327): Monolog\Handler\AbstractProcessingHandler->handle() #2 /var/www/html/owa/vendor/monolog/monolog/src/Monolog/Logger.php(565): Monolog\Logger->addRecord() #3 /var/www/html/owa/modules/base/classes/error.php(222): Monolog\Logger->error() #4 /var/www/html/owa/modules/base/classes/error.php(181): owa_error->logMsg() #5 /var/www/html/owa/modules/base/classes/error.php(254): owa_error->log() #6 /var/www/html/owa/modules/base/classes/error.php(104): owa_error->logBufferedMsgs() #7 /var/www/html/owa/owa_calle in /var/www/html/owa/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 146
Any clue why this happened and what I can do to fix it?

Composer can't find file on Linux

when I try
composer dump-autoload
I get the following error on my linux machine
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
PHP Warning: Uncaught ErrorException: require(/App/Helpers/AppHelper.php): failed to open stream: No such file or directory in /var/www/page/vendor/composer/autoload_real.php:66
Stack trace:
#0 /var/www/page/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/App/He...', '/var/www/pag...', 66, Array)
#1 /var/www/page/vendor/composer/autoload_real.php(66): require()
#2 /var/www/page/vendor/composer/autoload_real.php(56): composerRequire14063f7e5e06d46e1f9f9d444238e903('ba1c657daf90253...', '/App/Helpers/Ap...')
#3 /var/www/page/vendor/autoload.php(7): ComposerAutoloaderInit14063f7e5e06d46e1f9f9d444238e903::getLoader()
#4 /var/www/page/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/var/www/pag...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(292): Illuminate\Foundation\ComposerScripts::postAutoloadDump(Object(Composer\Script\Event))
#6 phar:///usr/local/bin/com in /var/www/page/vendor/composer/autoload_real.php on line 66
Warning: Uncaught ErrorException: require(/App/Helpers/AppHelper.php): failed to open stream: No such file or directory in /var/www/page/vendor/composer/autoload_real.php:66
Stack trace:
#0 /var/www/page/vendor/composer/autoload_real.php(66): Composer\Util\ErrorHandler::handle(2, 'require(/App/He...', '/var/www/pag...', 66, Array)
#1 /var/www/page/vendor/composer/autoload_real.php(66): require()
#2 /var/www/page/vendor/composer/autoload_real.php(56): composerRequire14063f7e5e06d46e1f9f9d444238e903('ba1c657daf90253...', '/App/Helpers/Ap...')
#3 /var/www/page/vendor/autoload.php(7): ComposerAutoloaderInit14063f7e5e06d46e1f9f9d444238e903::getLoader()
#4 /var/www/page/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(43): require_once('/var/www/pag...')
#5 phar:///usr/local/bin/composer/src/Composer/EventDispatcher/EventDispatcher.php(292): Illuminate\Foundation\ComposerScripts::postAutoloadDump(Object(Composer\Script\Event))
#6 phar:///usr/local/bin/com in /var/www/page/vendor/composer/autoload_real.php on line 66
PHP Fatal error: composerRequire14063f7e5e06d46e1f9f9d444238e903(): Failed opening required '/App/Helpers/AppHelper.php' (include_path='.:/usr/share/php') in /var/www/page/vendor/composer/autoload_real.php on line 66
Fatal error: composerRequire14063f7e5e06d46e1f9f9d444238e903(): Failed opening required '/App/Helpers/AppHelper.php' (include_path='.:/usr/share/php') in /var/www/page/vendor/composer/autoload_real.php on line 66
But when I do it on my windows machine its working fine.
The files Im trying to include are
"files": [
"App/Helpers/AppHelper.php",
"App/Helpers/CoinHiveApi.php",
"App/Helpers/CloudflareAPI.php"
]
Is there anyting I have to add/change?
In laravel, You need to gives proper path(without any letter cases change) of file /Directive.
When you are work with composer.json, .env, any provider etc you need to run below command because laravel create cache itself.
1) composer update (If you add new package)
2) composer dump-autoload (Why do I have to run "composer dump-autoload" command to make migrations work in laravel?)
3) php artisan cache:clear
4) php artisan view:clear(if you add new view)
As mentioned in the comments, case matters.
Composer takes file paths:
"files": [
"app/Helpers/AppHelper.php",
...
]
App !== app
The folder is app.

Migrated WordPress Site and Now Theme Isn't Loading WordPress Functions

Just migrated a website from local machine to staging server.
Weirdly, the theme isn't loading the functions even though the stack trace looks correct:
[15-Dec-2017 00:22:51 UTC] PHP Fatal error: Uncaught Error: Call to undefined function of_get_option() in /var/www/html/assets/themes/underscore/header.php:37
Stack trace:
#0 /var/www/html/wp-includes/template.php(555): require_once()
#1 /var/www/html/wp-includes/template.php(514): load_template('/var/www/html/a...', true)
#2 /var/www/html/wp-includes/general-template.php(45): locate_template(Array, true)
#3 /var/www/html/assets/themes/underscore/index.php(1): get_header()
#4 /var/www/html/wp-includes/template-loader.php(75): include('/var/www/html/a...')
#5 /var/www/html/wp-blog-header.php(16): require_once('/var/www/html/w...')
#6 /var/www/html/index.php(17): require('/var/www/html/w...')
#7 {main}
thrown in /var/www/html/assets/themes/underscore/header.php on line 37
I am in a hurry so I have tried just copying a copy of the of _get_option function into the file which got rid of the error.
But then up popped another one in it's place.
[15-Dec-2017 00:29:35 UTC] PHP Warning: include_once(../wp-includes\option.php): failed to open stream: No such file or directory in /var/www/html/assets/themes/underscore/header.php on line 33
[15-Dec-2017 00:29:35 UTC] PHP Warning: include_once(): Failed opening '../wp-includes\option.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/assets/themes/underscore/header.php on line 33
[15-Dec-2017 00:29:35 UTC] PHP Fatal error: Uncaught Error: Call to undefined function WC() in /var/www/html/assets/themes/underscore/header.php:79
Stack trace:
#0 /var/www/html/wp-includes/template.php(555): require_once()
#1 /var/www/html/wp-includes/template.php(514): load_template('/var/www/html/a...', true)
#2 /var/www/html/wp-includes/general-template.php(45): locate_template(Array, true)
#3 /var/www/html/assets/themes/underscore/index.php(1): get_header()
#4 /var/www/html/wp-includes/template-loader.php(75): include('/var/www/html/a...')
#5 /var/www/html/wp-blog-header.php(16): require_once('/var/www/html/w...')
#6 /var/www/html/index.php(17): require('/var/www/html/w...')
#7 {main}
thrown in /var/www/html/assets/themes/underscore/header.php on line 79
Anyone got any clue why this is?
themes/underscore/header.php has an incorrect reference to another file, this looks likely to be a problem /wp-includes\option.php

Database not update doctrine2

why I can't update database in my server?
This commit work in local server.
Help please, I do not already know where to look
icc-> php app/console doctrine:schema:update
PHP Warning: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Warning: require_once(/home/icc/web/icc.kdpu.edu.ua/public_html): failed to open stream: No such file or directory' in /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php:236
Stack trace:
#0 /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php(236): Symfony\Component\Debug\ErrorHandler->handleError(2, 'require_once(/h...', '/home/icc/web/i...', 236, Array)
#1 /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php(236): Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver::getAllClassNames()
#2 /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php(128): Doctrine\Common\Persistence\Mapping\Driver\Anno in /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php on line 236
PHP Fatal error: Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver::getAllClassNames(): Failed opening required '' (include_path='.:/usr/share/pear:/usr/share/php') in /home/icc/web/icc.kdpu.edu.ua/public_html/vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/AnnotationDriver.php on line 236
[Symfony\Component\Debug\Exception\FatalErrorException]
Compile Error: Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver:
:getAllClassNames(): Failed opening required '' (include_path='.:/usr/share
/pear:/usr/share/php')

Moving Laravel 5.3 project from Windows to Ubuntu

I recently moved my Laravel 5.3.1 (Repository pattern) project from Windows 10 to Ubuntu 16.04LTs. When I update the composer, I'm getting the following errors.
Illuminate\Foundation\ComposerScripts::postUpdate
PHP Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/new-abc.test.lk): failed to open stream:
Success in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php:55
Stack trace:
#0 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
Composer\Util\ErrorHandler::handle(2, 'require(/opt/la...',
'/opt/lampp/htdo...', 55, Array)
#1 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
require()
#2 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(45):
composerRequirecf118caaa79186b36c4e6ab213835334('efaf82f485f314c...',
'/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/new-abc.test.lk/vendor/autoload.php(7): ComposerAutoloaderInitcf118caaa79186b36c4e6ab213835334::getLoader()
#4 /opt/lampp/htdocs/new-abc.test.lk/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(30):
require_once('/opt/lampp/htdo...')
#5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238):
Illuminate\Foundation\Comp in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
Warning: Uncaught ErrorException: require(/opt/lampp/htdocs/new-abc.test.lk): failed to open stream:
Success in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php:55
Stack trace:
#0 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
Composer\Util\ErrorHandler::handle(2, 'require(/opt/la...',
'/opt/lampp/htdo...', 55, Array)
#1 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(55):
require()
#2 /opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php(45):
composerRequirecf118caaa79186b36c4e6ab213835334('efaf82f485f314c...',
'/opt/lampp/htdo...')
#3 /opt/lampp/htdocs/new-abc.test.lk/vendor/autoload.php(7): ComposerAutoloaderInitcf118caaa79186b36c4e6ab213835334::getLoader()
#4 /opt/lampp/htdocs/new-abc.test.lk/vendor/laravel/framework/src/Illuminate/Foundation/ComposerScripts.php(30):
require_once('/opt/lampp/htdo...')
#5 /usr/share/php/Composer/EventDispatcher/EventDispatcher.php(238):
Illuminate\Foundation\Comp in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
PHP Fatal error: composerRequirecf118caaa79186b36c4e6ab213835334(): Failed opening
required '/opt/lampp/htdocs/new-abc.test.lk/'
(include_path='.:/usr/share/php') in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
Fatal error: composerRequirecf118caaa79186b36c4e6ab213835334(): Failed opening required '/opt/lampp/htdocs/new-abc.test.lk/'
(include_path='.:/usr/share/php') in
/opt/lampp/htdocs/new-abc.test.lk/vendor/composer/autoload_real.php on
line 55
What I tried:
Removing the existing vendor folder
Removing the composer.lock file
Any help would be appreciated.
The problem was caused due to the case sensitive issue. I think windows have neglected but Linux didn't.
What I've done is, I've created a custom helper file and included in the composer.json.
The mistake was the actual filename case sensitive didn't match the included file in the composer.json.

Categories