Artisan packages error - laravel

I'm having some trouble with artisan/packages.. I've added a package to my composer file and ran composer update and an error was returned:
PHP Warning: require(/home/xxx/public_html/bootstrap/autoload.php): failed to open stream: No such file or directory in /home/xxx/public_html/artisan on line 16
I can see that require path is incorrect, my structure is like so:
/home/xxx/bootstrap
/home/xxx/app
/home/xxx/vendor
/home/xxx/public_html
I hadn't changed any of the paths and everything seemed to work out of the box with this structure, basically removing the public folder and pushing everything up a directory.
I've opened up Artisan tried a couple of paths that kept failing so i've changed them to absolute:
require '/home/xxx/bootstrap/autoload.php';
It seemed to work from here on, but at the end of the process got another error:
Writing lock file
Generating autoload files
[RuntimeException]
Could not scan for classes inside "app/commands" which does not appear to be a file n or a folder
Rather than continue to mess it up i thought now would be a good time to clear it up, any ideas how to fix this?

Make sure you are using php 5.3 or higher.
Run php -v

Try creating an empty "app/commands" folder, fixed the issue for me!

Related

Can't run an old laravel project

so i've beein struggling with an old laravel project from 2018 that i can't seen to run. The probem is that the project i splittedinto two folders not a classic laravel one, there's an other one named "httpdocs" and the index.php is there, so i managed to install everything and running the migrations, but noti can't run the website ? idk why it said:
Warning: require(C:\xampp\htdocs\httpdocs/../daddyshop_app/vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\httpdocs\index.php on line 24
the autoload.php file exists
I think this part is wired, see / and \ on the require:
require(C:\xampp\htdocs\httpdocs/../daddyshop_app/vendor/autoload.php)
Maybe you are setting wrongly the folder structure, or in the index.php file, you are searching in the wrong path.
For example, try checking paths are correct:
Maybe /../../laravel-app or ../.. or /../laravel-app.
You get the point, make sure paths are correct.

Laravel pdf issue: failed to open stream: No such file or directory by using barryvdh/laravel-dompdf package

I am update composer and use barryvdh/laravel-dompdf package.
the problem is when i click the button it show me error like image below:-
Is that anyway to change the folder path? or am I missing code to modify path to download the pdf file?
You need to run this command:
php artisan vendor:publish
Then, try to create a fonts directory in the storage directory.
i.e. storage/app/fonts. Also, remember to make it writable.
For maximum execution time of 30 seconds exceeded, this is not laravel related issue but it's about php configuration issue. Please see this and fix it: http://php.net/manual/en/info.configuration.php#ini.max-execution-time
You can also see this answer: https://stackoverflow.com/a/30290770/6000629
Hope this will helps you!
Try this:
$pdf = PDF::loadView('pdf/personalpdf', compact('user','result'))->setOptions(['defaultFont' => 'sans-serif']);
It worked for me, I didn't make any file/folder
Just remove the reference to css external file in your cart.placeOrder.blade
Note: This directory must exist and be writable by the webserver process.
under the config file thats what it say: therefore you should create the fonts directory inside the storage.
"font_cache" => storage_path('fonts/'),

Is NetBeans not accepting _ide_helper from Laravel?

Using NetBeans 8.2 with Laravel, I'm setting the _ide_helper.php to my project as described in his link https://github.com/barryvdh/laravel-ide-helper,
it was set on terminal the command
composer require barryvdh/laravel-ide-helper
then after, it was added into config/app.php the line
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
and for last, the command on the project folder
php artisan ide-helper:generate
but nothing has changed apparently. No auto complete, no references. Here are some images comparing what is expected and what is happening.
Expected
Happening
Plus, NetBeans is marking an error inside the ide_helper file which confuses the syntax by the name of the function ('if'). I'll put an image of the part showing the error
Error_NetBeans_ide_helper
I've rebooted NetBeans, tried downloading and setting directly the file, but no lucky. Is the function 'if' causing the problem? Or is NetBeans not accepting the _ide_helper?

Strange error with Symfony-2.8

I am using Symfony 2.8.18. I was always able to debug the previous error messages I had. I searched on Google for same errors but I did not find anything. Everything worked perfectly before. I restarted my local server and get the following error message:
Warning: class_implements(): Class �]� does not exist and could not be
loaded
Here is a link to the screenshot of the message: strange bug screenshot.
I deleted the cache by removing the corresponding folders and by using the following command:
php app\console doctrine:cache:clear-metadata && php app\console doctrine:cache:clear-query && php app\console doctrine:cache:clear-result
But it did not solve my problem. I do not know how to understand this error message.
Do you have any ideas on how to debug the code?
I did not change anything but it seems one or several files were corrupted. The solution was to:
Remove the vendor folder;
Run composer install.
My problem was solved by doing this.

php artisan optimize returns (Invalid filename provided.)

I was trying to publish my new laravel project using Forge+DigitalOcean but I get the error message (We were unable to install a project on your server) due to php artisan optimize command returning Invalid filename provided. error.
So I modified my .env file and set APP_DEBUG to false and tried to run the command locally. I got the following error:
php artisan optimize -v
Generating optimized class loader Compiling common classes
[RuntimeException] Invalid filename provided.
Exception trace: () at /home/bubut/Code/TalalAttendance/vendor/classpreloader/classpreloader/src/ClassPreloader.php:105
ClassPreloader\ClassPreloader->getCode() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:89
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:70
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at
/home/bubut/Code/TalalAttendance/bootstrap/cache/compiled.php:1138
Illuminate\Container\Container->call() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:150
Illuminate\Console\Command->execute() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Command/Command.php:258
Symfony\Component\Console\Command\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Console/Command.php:136
Illuminate\Console\Command->run() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:827
Symfony\Component\Console\Application->doRunCommand() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:191
Symfony\Component\Console\Application->doRun() at
/home/bubut/Code/TalalAttendance/vendor/symfony/console/Application.php:122
Symfony\Component\Console\Application->run() at
/home/bubut/Code/TalalAttendance/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:100
Illuminate\Foundation\Console\Kernel->handle() at
/home/bubut/Code/TalalAttendance/artisan:36
Laravel allows you to specify additional files to be compiled -- generally files that are used on every request in the application.
The file list is specified in /config/compile.php in the files array. If you have specified a file there but it does not exist (or the location is wrong) then artisan will throw that error when trying to compile it.
Same thing happened to me and removing the non-existent file from the list fixed my problem.
Same issue toady, and after debugging in Illuminate\Foundation\Console\OptimizeCommand, I found that some symfony components missing in vendor folder, even with composer install/update command for some reason.
Remove contents under vendor folder, then do composer update to see if missing components back. Or git clone whole project and composer update. Note that composer install will check composer.lock, if it existing and components missing there, issue triggered.
Note: For additional information
If your files are in a folder inside app folder, this is how you should list them.
'files' => [
'app/your_folder_name/file_a.php',
'app/your_folder_name/file_b.php',
'app/your_folder_name/file_c.php',
]
Hope this helps anyone who one to compile their custom functions.

Resources