Class not Found: Laravel Artisan via ssh - php

for a Laravel 5.1 project I am trying to setup a beta version of this project on a shared hoster. Everything works fine except for artisan.
I do login through ssh and move to the Laravel project directory and the not matter what php artisan command I use I get following error:
PHP Fatal error: Class 'Illuminate\Queue\ConsoleServiceProvider' not found in /www/htdocs///vendor/laravel/framework/src/Illuminate/Foundation/Application.php on line 543
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Queue\ConsoleServiceProvider' not found
Any ideas on what could be wrong?
The autoloading should work correctly as the project works fine using the browser.

The steps by #manix helped me a lot:
Delete file bootstrap/cache/services.json
call composer update
run php artisan optimize

Related

Testing Database using laravel dusk

I am testing my laravel application using laravel dusk but the problem is that I am unable to use assertDatabaseHasfunction. When I run php artisan dusk command I got this error:
PHP Fatal error: Class 'PHPUnit_Framework_Constraint' not found in
vendor\laravel\framework\src\Illuminate\Foundation\Testing\Constraints\HasIn
Database.php on line 8
Here is my code:
$this->assertDatabaseHas('teams', [
'name' => $data['team_name'],
]);
Please check your version of phpunit:
phpunit --version
If you are are running v6 you might have trouble because it expects a namespaced class. In that case you either have to switch to an older version of phpunit, e.g. locally installed for your project and then run like this:
php vendor/bin/phpunit --version
or you might have to update your Laravel-project, which is probably more work as you might have to change parts of your code.

Composer update - website stopped working

I updated the Composer using cmd window and got these errors:
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Darryldecode\Cart\CartServiceProvider' not found
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output:
The website is not online yet, and I'm running it using xampp.
Now, when i'm trying to access my web site through localhost, I get this error:
FatalErrorException in ProviderRepository.php line 146:
Class 'Darryldecode\Cart\CartServiceProvider' not found.
In the app.php file I have:
Darryldecode\Cart\CartServiceProvider::class,
in the Application Service Providers, and:
'Cart' => Darryldecode\Cart\Facades\CartFacade::class,
in the aliases.
Any ideas on how to get the website back?
Thanks!
Tty this steps
Temporary remove
Darryldecode\Cart\CartServiceProvider::class,
And
'Cart' => Darryldecode\Cart\Facades\CartFacade::class,
Type command
composer update
And then add this class
Because when you update composer he try to find this path before adding in your project, After updating your composer this class added in your folder

CouchBase class not found in laravel5

I use couchbase nosql database by ytake/laravel-couchbase package in my laravel 5.1 project
After install that package and run php artisan serve i got error :
PHP Fatal error: Class 'CouchbaseN1qlQuery' not found in /var/www/html/eee/vendor/ytake/laravel-couchbase/src/CouchbaseServiceProvider.php on line 71
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CouchbaseN1qlQuery' not found
I had this error for a long time.
For me, the problem was that the CLI user couldn't write in the laravel.log when the couchbase client was trying to write a warning to it. Check user permissions.

Class 'App\Providers\AppServiceProvider' not found

I have changed my application by using command
php artisan app:name [app_name].
Then, when I try to perform other actions using following artisan commands,
php artisan down
php artisan up
php artisan config:cache
I got the following error:
PHP Fatal error: Class 'App\Providers\AppServiceProvider' not found
How can I solve it?
It is working after Clearing bootstrap/cache directory.
This is how its worked out for me in the case of a fresh install.
First, I cleared the files in boostrap\cache.
Then, in config\app.php, I added the below line in the providers,
\Laravel\Telescope\TelescopeServiceProvider::class,
Then I ran the below commands
php artisan telescope:install
php artisan migrate
And it was working after this.
I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.
By the way my laravel version was 7.12.0.
In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.
I solved it by removing the line from the file and running composer install.
You might have deleted the folder called providers
App/providers.
I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked
I had the same issue, I solved it by,
migrate migration file - vendor>laravel>telescope>database>- manually.
check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist
Run in command shell>
npm run dev

Fatal Error While Running Artisan (Laravel) on Command Line

I am experiencing a fatal error while using artisan on the (fantastic) Laravel PHP framework.
I recently downloaded v3.2.1 of Laravel, and I tried running the following command line from within the directory that artisan resides:
php artisan key:generate
This should create a random key for me in my applications/application.php file. (Please see http://laravel.com/docs/artisan/commands for a specific reference to this command.)
However, when I run this command from the shell I receive the following error:
Warning: chdir(): No such file or directory (errno 2) in /home/[USERNAME REMOVED]/websites/[DIRECTORY REMOVED]/htdocs/dev/sb4/paths.php on line 62
Parse error: syntax error, unexpected T_STRING in /home/[USERNAME REMOVED]/websites/[DIRECTORY REMOVED]/htdocs/dev/sb4/laravel/core.php on line 1
This is what's on line 62 of paths.php:
chdir(__DIR__);
This is what's on line 1 of core.php:
<?php namespace Laravel;
My question is this: Are there any specific environment, directory, or other permissions that I should modify to get artisan up and running.
A little background:
I installed Laravel 3.2.1 yesterday for the first time
I can run a simple web application successfully on my system (i.e. I can route a request to a controller and load up the associated blade properly)
I simply downloaded the Laravel 3.2.1 (laravel-laravel-v3.2.1-8-gaae8b62.zip) from GitHub and extracted it on my server
My environment:
PHP 5.3.13 on a shared host at Dreamhost
FireSSH to run the commands
My root directory: (permissions in parenthesis)
/application (775)
/bundles (775)
/laravel (775)
/public (775)
/storage (775)
/artisan (664)
/paths.php (777)
Please let me know if there are any other details about my setup that relevant. I'm really not sure what will help in troubleshooting this issue.
--
UPDATE: I also posted this issue to Laravel's GitHub issue tracker. (https://github.com/laravel/laravel/issues/820)
First off, thanks #KingCrunch, your first response led me down the correct path toward resolving this issue. Additionally, I received an excellent response from Dreamhost technical support (specifically Gary S), who gave me the concise answer I was looking for.
The issue was: I was running PHP 5.2.17 at the CLI, whereas my web server was running PHP 5.3.13.
The resolution is: Use
/usr/local/php53/bin/php artisan <command>
when running artisan commands at the CLI. This will ensure that all of my artisan commands are run using PHP 5.3 and above, which satisfies Laravel's PHP 5.3+ requirements.
Namespaces and the __DIR__-pseud-constant were introduced in PHP 5.3. It seems you are running an old version. You should update to at least 5.3.
php -v

Categories