In trying to get Laravel Valet up and running, I have stumbled upon this issue. When running 'valet install' or 'valet park' or any valet-command at all, I get the following error:
> PHP Fatal error: Cannot redeclare info() (previously declared in /Users/jantore/.composer/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:454) in /Users/jantore/.composer/vendor/laravel/valet/cli/includes/helpers.php on line 20
>
> Fatal error: Cannot redeclare info() (previously declared in
> /Users/jantore/.composer/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:454)
> in
> /Users/jantore/.composer/vendor/laravel/valet/cli/includes/helpers.php
> on line 20 eger:~ jantore$
I went through the helpers.php document and tried to comment out the info()-function, but that didn't make a difference.
I have a fresh Brew install with PHP 7.0 as per the Valet-install instructions.
Anyone have any clue what this might be?
Update: As per Ben Swinbourne's suggestion I tried with composer global dump-autoload. Unfortunately the same result, no change in the error. Thanx to Ben for the suggestion though :)
I know this is an old topic, I recently had a similar issue, except mine was around the retry() function.
to solve it.
composer global remove laravel/valet
composer global require laravel/valet
This might help you, try deleting the composer.lock file and the vendor directory and then do a composer update.
Related
I have a Laravel/Homestead project that is finally working locally. Now I'm trying to port it over to HostGator and can't get it running due to titled error. I've tried all the suggested solutions to no avail. Including:
composer require laravel/laravel
composer dump-autoload
composer install --no-scripts
composer update
composer update --no-scripts
Nothing works. Same error. If this is a clue, I also tried
php artisan clear-compiled
and get response of
Could not open input file: artisan
I'm about ready to give up on Laravel/Homestead. I've spent countless hours on this framework with nothing but problems to show for it. Would not recommend it to anybody.
You can see the error yourself here:
http://www.tekknow.net/MedAverter/medaverter/
Any suggestions before I throw in the towel?
For the artisan file, the artisan file is not required through includes, you have it in your root project, which is created when you create your Laravel project. Here is the file.
So you need to have that file in your project.
For the missing class, you try to require laravel/laravel but that is not the correct dependency. Again that github repo is a shell for a project, to have Laravel features you need to base of laravel/laravel and include laravel/framework.
Hope this clears up some confusing and can get you on the right track. Secondly you shouldn't port it over, but simply cloning your project and running composer install should be sufficient.
The problem turned out to be two issues.
1. The wrong version of PHP was running. If I ssh'ed into the hostgator server and did
php -v
It showed PHP 5.6.30 even though I had selected Php 7.1 in the cPanel PHP Selector. If I did
tekknow.net/phpinfo.php
it would say I was using 7.1. Called up HostGator tech support and they were able to change it to PHP 7.3.13.
Now if I do:
php artisan clear cache
I no longer get the error about
Parse error: syntax error, unexpected '?' in
/home1/sl1k7f3j/public_html/medaverter/bootstrap/app.php on line 15
which was an error caused by a version of php that doesn't support the ?? operator.
The second problem was a lack of memory issue. If I did
composer update
It would start to work but would fail in about 30 seconds with
Fatal error: Out of memory (allocated 709623808) (tried to allocate
34187559 bytes) in
phar:///opt/cpanel/composer/bin/composer/src/Composer/Json/JsonFile.php
on line 270
The HostGator tech rep could not figure out why that was happening but I got around that issue by manually uploading my local vendor folder to the host server.
Now when I go to http://tekknow.net/medaverter/ it works!
I'm installing Valet on my MacBook Pro - El Capitan.
I installed PHP and MySQL with Homebrew as suggested on the Valet documentation page.
However, when I try to install Valet, I get the error:
PHP Fatal error: Cannot redeclare resolve() (previously declared in /Users/marc/.composer/vendor/hoa/core/Protocol.php:1140) in /Users/marc/.composer/vendor/laravel/valet/cli/includes/helpers.php on line 57
Fatal error: Cannot redeclare resolve() (previously declared in /Users/marc/.composer/vendor/hoa/core/Protocol.php:1140) in /Users/marc/.composer/vendor/laravel/valet/cli/includes/helpers.php on line 57
My composer.json file looks like this:
{
"require": {
"phpunit/phpunit": "~4.2",
"phpmetrics/phpmetrics": "^1.10",
"laravel/valet": "^1.1"
}
}
I have tried deleting composer.lock and deleted the vendor directory, then composer install, but nothing changes. Any one have any advice here?
I ran into this recently and I was able to resolve it by uninstalling / reinstalling valet:
composer global remove laravel/valet
then
composer global require laravel/valet
Basically there are 2 methods called the same thing, one in
/Users/marc/.composer/vendor/hoa/core/Protocol.php line 1140
and the other in /Users/marc/.composer/vendor/laravel/valet/cli/includes/helpers.php on line 57.
A quick fix would be to remove the phpmetrics/phpmetrics dependency and run composer install again
Good thing is that in both places they check if the function exists, so you can declare it yourself.
If declare your own version before the vendor/autoload.php file is loaded, if you have control over this. So you could declare it to do what it currently does in Laravels helpers.php
I see you solved your issue, but for posterity:
You may have ran: composer global require "laravel/laravel"
Then ran: composer global require "laravel/installer"
Run: composer global remove "laravel/laravel" to get rid of the duplication.
I just up updated composer.phar in my local environment.
Now, I get an error that says
Fatal error: Class 'phpseclib\Crypt\AES' not found in /var/www/html/tms2/fuel/core/classes/crypt.php on line 213
How can I fix this?
Do you use 1.8/develop?
Recently it has switched to the composer version.
https://github.com/fuel/fuel/commit/87c1a6feb5deaff63dfa2cb561035ea6c51b724b
Check your composer.json and update it, then do composer update again.
I'm a newbie in Laravel. I just cloned my co-worker git and try to php artisan list but it gives me error
PHP Fatal error: Class 'Bllim\Datatables\DatatablesServiceProvider' not found in /Users/path-to-project/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
I can't find any documentations about this error and search results don't really help.
Any of you ever met this problem and care to help me fix this? Thank you.
Asking your coworker would be a first good step :)
That said, the error you're getting indicates that PHP can't find or autoload a Laravel Service provider class. If your coworker is following Laravel best practices, you should be able to fix this by running the following command from your root project directory (or the directory with a composer.json file)
$ composer install
or ...
$ composer.phhar install
The format of the command (phar or no phar) will depend on how you've installed composer, the dependency/package manager used in Laravel.
I have been working on the same app for a little bit now, and I am moving it over to Laravel. This is not only my first experience with Laravel, but my first time using a PHP framework. It is awesome so far.
I have run into a problem in my testing, I am getting an error: Error Output: PHP Fatal error: Class '...ServiceProvider' not found in /var/www/laravel/bootstrap/compiled.php on line #
I am wondering what causes this error and how I can fix it . It gives me the direct line that is problematic. But I have no idea how to solve this issue.
I have tried a number of solutions including
composer install
composer update
composer dump-autoload
and others as well.
I have also attempted deleting the compiled.php file all together, but then it trips the same error on a different file. What is it causing this error, and how can I go about debugging it?
Thanks for help in advance!!
Try running the following command:
php artisan clear-compiled
If that gives you the same error, you'll have to manually delete the file:
rm app/bootstrap/compiled.php
For laravel 5.5.*
you can remove related ServiceProvider in this file
\bootstrap\cache\config.php