Laravel 4 Class not found in bootstrap/compiled.php - laravel-4

I have created a new branch using Git, applied some updates to my code, checked out that branch on my staging server and I now can't run anything composer related.
I've added some new packages to composer.json which work on my development environment, but as soon as I try composer update on the staging environment I get class not found errors relating to the classes it's not yet downloaded.
I've tried
composer update
composer dump-autoload
php artisan clear-compiled
php artisan dump-autoload
php artisan optimize
But all result in the following error
PHP Fatal error: Class 'Artdarek\OAuth\OAuthServiceProvider' not found in
/var/www/sites/x/bootstrap/compiled.php on line 4321
Script php artisan clear-compiled handling the
pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Artdarek\OAuth\OAuthServiceProvider'
not found in /var/www/sites/x/bootstrap/compiled.php
on line 4321
What else can I try in order to get composer to download new files?

php artisan optimize --force
That command will re-generate /bootstrap/compiled.php
The --force arg is needed to re-generate the file when your environment is in debug mode.

I'm sure there is a more elegant way of dealing with this (and please accept any answer that provides that over this one) but this can probably be solved by deleting the entire vendor directory and running composer install again.
I know its not pretty but sometimes it's easier and quicker.

I had the exact same issue, which I solved by uploading the project again through filezilla to my server.
That doesn't solve the issues you are having with composer, however. Which begs the question: Assuming that you are working on a dedicated server, do you have composer installed globally in your server? If not you should still be able to do a php composer.phar update or just create an alias.
I might have misunderstood your question, and I realize that your question was asked a while back, but hopefully it will be helpful for someone else.

Related

Suddenly getting "Target class [Inertia\Ssr\Gateway] does not exist." I don't use Inertia's SSR. How can I get back to a functioning site?

I've got a Laravel Jetstream project using Inertia. I've been running it for a while. Launched on Jetstream v1, later upgraded to v2. Everything has been running great. Today I was messing with some composer and npm stuff and suddenly every page is broken. I just get an error that looks like this:
Illuminate\Contracts\Container\BindingResolutionException
Target class [Inertia\Ssr\Gateway] does not exist.
This happens on every view. I have never used Inertia's SSR, and I don't want to (at least not currently). I tried resetting both my composer json files and my npm json files but I cannot get back to my functioning site. I'm losing my mind. Any ideas of how I can get back to my original functioning site?
Try to remove vendor folder and node_modules.
Then run
composer install
and :
npm install
After that try to run these commands:
php artisan cache:clear
php artisan view:clear
php artisan route:clear
composer dump-autoload

Laravel with php 7: No supported encrypter found

This question has been asked for many times, so let me list the steps I did on it:
Setting 'cipher' => 'AES-128-CBC', (original AES-256-CBC);
php artisan key:generate
pasting the new key to the .env file
but the error remains the same.
In phpinfo, mcrypt shows enabled, although there's no extension in httpd.conf. Some answers says that the extension is integrated with php 7.
The project is downloaded from git and installed with composer and npm, the .env file was sent from another developer.
Might be there is a problem with your mcrypt. You need to check whether mcrypt php extention is installed or not and it should be enabled.
on command prompt run php -m | grep mcrypt
if you couldn't find in your apache just install it.
https://www.myoddweb.com/2010/11/18/install-mcrypt-for-php-on-windows/ here is the link.
After performed last two steps from you listed into your problem, have you clear config cache?.
If not then you must run php artisan config:clear because Laravel caches all config data.
Also why you change cipher? if no reason, revert it with original and performed the steps again.
Might this work for you.

How to Uninstall Laravel?

I am facing fatal errors regarding Artisan. I think I couldn't install laravel complete due to slow internet. Now I want to remove Laravel from root and want to have fresh installation.
Can anyone help me?
if you have installed it globally you can simply remove it by composer global remove laravel/installer
If you have installed it via composer project you simply remove the directory.
Since I was looking all around how to uninstall packages and after reading tones
of documentations here's the short how-to uninstall a workbench package in Laravel
Remove package service provider from 'providers' array in app/config/app.php
Remove the package folder in workbench/
Run:
php composer.phar dump-autoload
php artisan clear-compiled
php artisan optimize
(optional) remove all related code using the package (you'll get errors about that)
or use composer global remove laravel/installer
For me, the command that actually did the trick was: composer global remove laravel/installer

Laravel 4 PHP Fatal error: Class 'Monolog\Formatter\LineFormatter' not found in bootstrap/compiled.php on line 7991

I haven't used composer or Laravel 4 during the last couple of weeks, today I created a new Laravel project and suddenly Monolog is causing a ton of problems.
At first I was unable to fully create the project, afterwards I was unable to create a migration, and now I can't run php artisan serve any more. I followed the steps on Laravel 4 Class not found in bootstrap/compiled.php and that helped the first time around, but after creating the second migration and wanting to run a php artisan migrate I get the following error:
PHP Fatal error: Class 'Monolog\Formatter\LineFormatter' not found in /bootstrap/compiled.php on line 7991
How do I fix this?
I have update composer using self-update, I have tried to use dump-autoload, and the other steps in the question I posted a link to.
I solved this issue by deleting the vendorfolder and then running a composer install to ensure a fresh install of all packages in the composer.json.
I'm not sure how you installed the project. If you're trying to impose Laravel 4 over an old project, I suggest you to install FRESH Laravel using this command
composer create-project laravel/laravel project_name --prefer-dist
This should not give you any installation related problem unless the Laravel installation itself is broken. Which is very unlikely to happen.
You can then copy your controllers, models, migrations etc from the old project.
Good luck.

artisan or composer commands - php fatal error

I made one change in my composer.json including Facebook SDK package (http://packagist.org/packages/facebook/php-sdk).
So during the composer update I got this error
$ php artisan optimize
PHP Fatal error: Interface 'SessionHandlerInterface' not found in
/Users/Leandro/www/bootstrap/compiled.php on line 2644
After this, I can't run artisan or composer commands. Always get the same error.
I tried to remove Facebook SDK from composer json but not works.
Some help? Using --no-scripts the command works fine:
composer update --no-scripts
try to do this :
composer dump-autload
composer update
i think this may or may not solve it for you ..
you may need to delete the .json file which can be found on app\storage\meta, not 100% sure but it might work ..
Check out this troubleshooting checklist, sounds like you need to do a php artisan dump-autoload though.

Resources