我知道还有很多其他问题也有同样的错误,例如:Class 'Illuminate\Html\HtmlServiceProvider' not found Laravel 5
我的问题是我已经按照所有建议的步骤在我的本地(XAMPP)上解决了这个问题,并且顺利修复了它。问题是当我去部署到我的 AWS ubuntu 机器(nginx)时。我遵循了所有通常的说明: http: //laravelcollective.com/docs/5.1/html#installation
当我从本地推送的内容中执行 git pull 时,我的提供者和别名已添加。也许这个文件应该已经被 gitignored,并且在服务器上手动进行了更改?
Next, add your new provider to the providers array of config/app.php:
'providers' => [
// ...
Collective\Html\HtmlServiceProvider::class,
// ...
],
Finally, add two class aliases to the aliases array of config/app.php:
'aliases' => [
// ...
'Form' => Collective\Html\FormFacade::class,
'Html' => Collective\Html\HtmlFacade::class,
// ...
],
然后我手动添加:
Begin by installing this package through Composer. Edit your project's composer.json file to require laravelcollective/html.
"require": {
"laravelcollective/html": "5.1.*"
}
最后,我跑了:
composer.phar update
它正在运行这个引发错误的命令:
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
> php artisan clear-compiled
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Fatal error: Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line 6
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Collective\Html\HtmlServiceProvider' not found
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Fatal error: Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line
update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-auties] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ...
然后我尝试运行 php artisan clear-compiled,看看它是否会做任何事情,并得到:
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Fatal error: Class 'Collective\Html\HtmlServiceProvider' not found in /usr/share/nginx/html/cbt/vendor/compiled.php on line 6716
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Collective\Html\HtmlServiceProvider' not found
我知道我的 nginx ubuntu 环境与 windows xampp env 不同,但我仍然不确定为什么按照 Laravel 提供的添加说明似乎不起作用。非常感谢对此的一些建议。
干杯!