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
Related
I am new to VS code. I am trying to work with PHP, but I keep getting this notification.
phpcs: Request workspace/configuration failed with message:unable to
locate phpcs. please add phpcs to your global path or use composer
dependency manager to install it in your project locally.
Intellisense doesn't work for PHP too.
I am using a Windows system. I tried to download and install Composer, but I am still getting the problem as shown in the screenshot.
]1
I have some extensions installed which are visible in the screenshot, but the issue persists.
The easiest way is to use composer to install phpcs globally and symlink the binary into your path;
Assuming you have composer installed and are using osx or linux (if not, follow instructions from here: composer) then install phpcs globally: open your terminal and type:
composer global require "squizlabs/php_codesniffer=*"
You will then need to make sure phpcs is in your path. The easiest way is to symlink into /usr/local/bin. open your terminal and type:
sudo ln -s ~/.composer/vendor/bin/phpcs /usr/local/bin/phpcs
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
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.
I don't know if this question has been asked, because searching finds results mostly about moving the libraries installation directory.
I have a globally installed composer command. Is there a way to run, for example, composer install in a different directory than current, i.e. to specify the directory in which I would like tu run the command?
E.g. being in /home/someuser, I would like to acquire the same result as in running composer install it inside /home/someuser/myproject. Of course, one way would be to simply change the current directory, run composer and go back.
Try composer install -h. There you'll find an option --working-dir (or -d). And that's what you're looking for.
Then run:
composer install --working-dir=/home/someuser/myproject
You can find more in composer docs.
Depending on your operating system, the = might need to be removed:
composer install --working-dir /home/someuser/myproject
In addition to the above answer from Tomáš Votruba i had to append the = charachter on OSX. So the full command would be:
composer install -d=/home/someuser/myproject
My first post on SO so was unable to simply add this as a comment.
This works for me, PHP 7.3 on ubuntu 18.04
Install
composer install --working-dir=/your_composer_dir
Update
composer update --working-dir=/your_composer_dir
I tried what others said, but it was giving me: Invalid working directory specified 'PATH' does not exist. Although it was my working dir that contained composer.json!
I don't know why anyway, but this worked for me (only for gnu/linux users):
composer --working-dir=$(pwd)
And by the way, if you had run composer -h, it would've told you the solution:
-d, --working-dir=WORKING-DIR If specified, use the given directory as working directory.
I am using a Windows machine with PHPStorm (terminal) and this worked for me.
composer install --working-dir /home/someuser/myproject
My Linux OS machines require me to use
composer install --working-dir=/home/someuser/myproject
Note: You may be able to substitute ~/ for /home/someuser/ if your path is super long.
Run:
cd /home/mysites/google.com
Then run:
composer require facebook/graph-sdk
Above steps will open up the directory named (google.com) and install facebook Graph SDK there.
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.