Symfony 3: I can't install ckeditor - php

When I follow this documentation to "Integrating IvoryCKEditorBundle to Create a WYSIWYG Editor" in my app, I get the following error:
[Symfony\Component\Debug\Exception\ClassNotFoundException] Attempted to load class "ZipArchive" from the global namespace. Did you forget a "use" statement?
This happens at the step 4.
I really have no idea about what could triggers this error. Due to my OS configuration? PHP Version? Symfony config? Etc?

I encountered the same issue today and tried the solution proposed in the comments by Malcom (thanks, Malcom - it worked!):
sudo apt-get install php7.0-zip

please note that you can also change the php version, for 5.6 use sudo apt-get install php5.6-zip

Related

Laravel composer install giving error "Your lock file does not contain a compatible set of packages please run composer update"

I have been writing laravel code for quite sometime. Currently, I tried cloning a project from github and editing locally. I installed composer in my project directory but a vendor folder was not included, I tried to run composer install but I gives me this error
Your lock file does not contain a compatible set of packages. Please run composer update
How do I resolve this?
Note: I have tried running composer update on previous clones and that didn't work.
Run this command:
composer install --ignore-platform-reqs
or
composer update --ignore-platform-reqs
Disclaimer, this solution will not fix the issue for PHP 8 projects.
In most cases this happens because of PHP 8 (In my case it was GitHub CI actions automatically started using PHP 8 even though my project is php 7.4)
If you have multiple PHP installations (E.g. 7.4 and 8 on the same server), this is how you can fix it.
Specify your php version in your composer.json file
"config": {
"platform": {
"php": "7.3"
}
},
If you have the lock file already committed, run composer update after you adding above line in to the composer.json and then commit the new lock file. (Please be aware composer update will upgrade your packages to latest versions)
I solved this problem with this command:
composer self-update --1
It probably works because at time that the project was developed, composer was on another version and when change the Major version from 1 to 2 the compatibility was broke. With this command you downgrade composer and probably going to solve this
You should try running composer update --lock that will update all packages and recreate the compose.lock file.
Either you can delete the composer.lock file and run composer install that will also recreate the .lock file.
This resolved my issue.
I had this error with Github Actions trying to deploy a Laravel app, this is probably different than the OP's case but none of the suggestions worked for me. Adding my answer here just in case there is someone else out there with a similar problem to mine.
I had to disable -q in Github Actions and see that it was complaining about extensions not being installed.
Make sure your require section of composer's php extensions matches the extensions: in your github action file for shivammathur/setup-php#v2 and it will deploy again
Recently I've just come across of this error when I tried to run my Laravel 7 project which required php v7.* with php v8. As I forgot my php version I just tried bunch of composer command, but just got error after error.
Anyway, to solve this just downgrade/upgrade php version as required. Just search how to do that in youtube.
you can see your project required php version in composer.json file (just if you wonder)
Also you can try following way (But though it didn't worked for me, seems it helped quite some people)
-- Open composer.json file and change php version to something like this: "php": "^7.3|^8.1"
-- Then run composer update
I faced this problem with my cakephp project in garuda linux (arch based)
Fix :
Install php-intl using sudo pacman -S php-intl
Enable php intl by editing php config ( in my case /etc/php/php.ini ) .
add extension=intl or uncomment the existing one
restart apache or whatever you are using
I had the same error deploying another project with composer, but the problem was a missing php extension.
I understand you solve your problem but for anyone seeing the same error message, here is a general guidance :
The error message Your lock file does not contain a compatible set of packages. Please run composer update is shown each time there is a conflict during the dependency solving step of composer install. (see the relevant part in composer source code)
It doesn't inform on the real problem though, and it could be hard to guess.
To get the exact explanation you can add --verbose option to composer install command (the option is available to any composer command (see the doc)) : composer install --verbose
It will give you the full message explaining what exactly is preventing composer install from completing (package version conflict, missing php extension, etc.), then you'll be able to fix the problem.
Hope this could help.
In my case this problem is occuring in Ubuntu 20.04 Desktop. This is due to some missing packages.
I ran the following commands to install some packages then rerun Composer install and its working properly. The commands are:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
Then rerun composer install

Laravel Snappy PDF Exit Status Code 127

I am trying to print a HTML to PDF file for hardcopy and file purposes of my project in Laravel. I tried to use the barryvdh/laravel-snappy so I followed the documentations carefully and I also installed this wkhtmltopdf for ubuntu 16.04 64x bit cause I think it is required in order to use this package. But there is a big problem. When I generate a PDF sample using Snappy it gives me this error.
Is there something wrong in the installation of my wkhtmltopdf? or is it a directory issue? I tried to sudo chmod -R 777 usr/bin/wkhtmltopdf but still got the same error.
I also followed this this link to help me out. But ended up in the same error.
Looking for help.
Thanks in advance.
Btw I am using Ubuntu 17.10 64-bit
wkhtmltodf version - 0.12.3.2
I would suggest you to use the below package for integrating PDF feature.
I personally use this and its working great and easy to use.
https://github.com/barryvdh/laravel-dompdf
If you came across any issue using this plugin please ask me i will help you out for sure.
E.g
Make sure to install and configure this package as mention in the document also make sure to run the below command after installation and configuration of this package.
php artisan vendor:publish --provider="Barryvdh\DomPDF\ServiceProvider"
then try using the below code:
$date = Carbon::now()->format('j F, Y');
data = ['date'=>$date];
$pdf = PDF::loadView('admin.pages.application', $data)->setPaper('a4');
return $pdf->download('download.pdf');
on my Ubuntu 20.04 i had to install a few more dependencies for it to work
Edit this file /etc/apt/sources.list and add this line to the end of it: deb http://security.ubuntu.com/ubuntu bionic-security main
After that run: sudo apt update && apt-cache policy libssl1.0-dev
Finally: sudo apt-get install libssl1.0-dev
And finish with: sudo apt-get install libxrender1
Please give 777 permission to vendor folder and then check it

Why cant I run bin/behat?

I am trying to run behat on my vendor folder. I have installed composer globally, have installed the behat package, but every time I run bin/behat I keep getting this message from composer
You must set up the project dependencies, run the following commands:
curl -s http://getcomposer.org/installer | php
php composer.phar install
I am not sure how to fix this. I see the files are in the vendor folder, and when I type "composer" on the terminal, I see the manual.
If anyone can help me resolve this I would really appreciate it. Thanks!
There are several possible problems leading to this situation:
Make sure that composer is installed in your $PATH. That is, running composer at a command prompt should work, and you shouldn't need to run an explicit path like ~/Downloads/composer.phar
Execute the composer install instruction as the error message suggests. A common error is the message
Mcrypt PHP extension required
in which case you need to install the specified extension. For example, brew install php56-mcrypt on a Mac or sudo apt-get install php5-mcrypt on Ubuntu.

Laravel Artisan Migrate Install [mcrypt php extension required]

I am receiving this error whenever I try to install Laravel Artisan Migrations. I'll tell you what I have done...
I have gone into my .bash_profile:
export PATH=/opt/local/bin:/opt/local/sbin:/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php/php5.5.3/bin:$PATH
and when I check to see which version of PHP I am using, it's the one in my MAMP folder. And it is certainly enabled! But when I type Laravel Artisan: Migrate: Install it prompts me back with MCrypt PHP extension required. Composer is functioning properly. So is Laravel 4. It's this Migrations that is giving me trouble.
Not sure that a user name like LaravelSucks is going to make it easy for you to get help from the Laravel community, but since we're generally bigger than that ... I think you'll find your answer here.
If that doesn't work for you, you may need to set it up manually, e.g.
sudo apt-get install php5-mcrypt

Symfony2 : --reinstall issue

I have been trying to install Buzz for Symfony2. I added it to the deps file, and tried to update my vendors :
php bin/vendors update
The command simply tells me that I've installed the standard version, and that I should try to use :
php bin/vendors install --reinstall
instead. Which I did.
But then an error pops in and tells me :
Updating deps.lock
sh:/var/www/Symfony/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php: not found
PHP Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in /var/www/Symfony/app/autoload.php on line 37
PHP Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in /var/www/Symfony/app/autoload.php on line 37
And then nothing works anymore, which is not surprising because my vendors folder is almost empty.
Has anyone encountered this problem before? Any clue on how to fix it?
Edit :
I found out the origin of this error. I didn't have git installed, so I did :
sudo apt-get install git-core
Check this link for more info on that : http://comments.gmane.org/gmane.comp.php.symfony.symfony2/8239
However I'm having another error now ("Looked for namespace "buzz.client.curl", found none"). I'm making another thread for that one, as it is not the same problem (link here).
That's not the right way to update your vendors. Per the docs
There is also a php bin/vendors update command, but this has nothing
to do with upgrading your project and you will normally not need to
use it. This command is used to freeze the versions of all of your
vendor libraries by updating them to the version specified in deps and
recording it into the deps.lock file.
Ergo, all you need to do is run php bin/vendors install (I know, it's confusing. I partially blame them for poorly naming the sub-command)
EDIT
To help resolve your current issues, try these steps
rm -rf vendor/*
rm -rf app/cache/*
rm app/bootstrap.php.cache
php bin/vendors install
Hope it works
Try to remove everything from "vendor" folder and run
php bin/vendors install
command
Before you add in deps file copy all the content of deps file in any of your text editor,then delete all your contents of deps and add the Buzz link in deps only.
Then try the below command
php bin/vendors install --reinstall
this will install the BUZZ bundle safely. After installing BUzz bundle you can paste all the deps content that you have copied earlier.
If you are trying this make sure to download new symfony project and try this.
May be this will helps you. I tried it earlier on one of my project.

Categories