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.
Related
I'm trying to install an existing Laravel project by running a "composer install" command but i'm getting the following errors :
PHP Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Fatal error: Uncaught Error: Class 'Symfony\Thanks\Command\ThanksCommand' not found in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php:58
Stack trace:
#0 /usr/share/php/Composer/Plugin/PluginManager.php(236): Symfony\Thanks\Thanks->activate(Object(Composer\Composer), Object(Composer\IO\ConsoleIO))
#1 /usr/share/php/Composer/Plugin/PluginManager.php(205): Composer\Plugin\PluginManager->addPlugin(Object(Symfony\Thanks\Thanks))
#2 /usr/share/php/Composer/Plugin/PluginManager.php(261): Composer\Plugin\PluginManager->registerPackage(Object(Composer\Package\CompletePackage))
#3 /usr/share/php/Composer/Plugin/PluginManager.php(76): Composer\Plugin\PluginManager->loadRepository(Object(Composer\Repository\InstalledFilesystemRepository))
#4 /usr/share/php/Composer/Factory.php(384): Composer\Plugin\PluginManager->loadInstalledPlugins()
#5 /usr/share/php/Composer/Factory.php(576): Composer\Factory->createComposer(Object(Composer\IO\ConsoleIO), Array, false)
#6 /usr/share/php/Composer/Console/Application.php(332): C in /home/lyes/Documents/AppStage/vendor/symfony/thanks/src/Thanks.php on line 58
Can anyone help me, I am really overwhelmed
Just delete vendor folder and than run composer update command
Try using composer update and composer dump-autoload command
When you run composer install it will look for a lock file and install whatever is contained in it. Check if your composer.lock or run composer update command
Try the following steps:
Remove the vendor folder if already there
Delete the composer.lock file
Run composer install command in the terminal.
I have a laravel project I installed the composer
and run
composer install
After that I executed the update command
composer update
on the project's root directory, and during the execution on the command
php artisan optimize
I got the error shown in the attached image.
When I try to execute any php artisan command I got the same error too.
Error lines
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#2 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalThrowableError))
#3 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
PHP Fatal error: Uncaught Error: Call to undefined method Illuminate\Support\Facades\Auth::check() in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:221
Stack trace:
#0 C:\xampp\htdocs\projectx\app\Exceptions\Handler.php(39): Illuminate\Support\Facades\Facade::__callStatic('check', Array)
#1 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(81): App\Exceptions\Handler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#2 C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(123): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\Debug\Exception\FatalErrorException))
#3 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#4 {main}
thrown in C:\xampp\htdocs\projectx\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221
You could try to use the append_config() helper method in your environment app configuration file:
'providers' => append_config(array(
'LocalOnlyServiceProvider',
))
The command php artisan optimize has been remove in laravel 5.6
see more: https://laravel.com/docs/5.6/upgrade
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
I just added tinker to my Laravel project 5.4.
When I try to run:
php artisan tinker
I am getting following error:
PHP Warning: Uncaught ErrorException: require(/home/abdullah/php_apps/website): failed to open stream: Success in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php:51
Stack trace:
#0 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'require(/home/a...', '/home/abdullah/...', 51, Array)
#1 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(51): require()
#2 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php(33): Laravel\Tinker\ClassAliasAutoloader->__construct(Object(Psy\Shell), '/home/abdullah/...')
#3 /home/abdullah/php_apps/website/vendor/laravel/tinker/src/Console/TinkerCommand.php(59): Laravel\Tinker\ClassAliasAutoloader::register(Object(Psy\Shell), '/home/abdullah/...')
#4 [internal function]: Laravel\Tinker\Console\TinkerCommand->handle()
#5 /home/abdullah/php_apps/website/vendor/laravel/framework/src/Illuminate/Contai in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
PHP Fatal error: Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php') in /home/abdullah/php_apps/website/vendor/laravel/tinker/src/ClassAliasAutoloader.php on line 51
[Symfony\Component\Debug\Exception\FatalErrorException]
Laravel\Tinker\ClassAliasAutoloader::__construct(): Failed opening required '/home/abdullah/php_apps/website' (include_path='.:/home/abdullah/.phpbrew/php/php-7.0.1/lib/php')
I have tried giving rights to various folders.
Also tried adding the Tinker class to console/kernel.php.
I fixed it finally by upgrading my version of laravel.
Laravel v5.4.0 to Laravel v5.4.33.
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.