phantommagick icon indicating copy to clipboard operation
phantommagick copied to clipboard

Binary does not exist

Open meliksahk opened this issue 9 years ago • 10 comments

I can use phantommagick in local server but when I upload my laravel project to my server; Converter::make($html) ->toPng() ->download('teklif.png'); is return me "binary does not exist". Please help

meliksahk avatar Feb 08 '16 10:02 meliksahk

@meliksahk are you using anam/phantomjs-linux-x86-binary? if not please read the following:

https://github.com/anam-hossain/phantommagick#binary

anam-hossain avatar Feb 13 '16 13:02 anam-hossain

yes I m using anam/phantomjs-linux-x86-binary. Also I tried setBinary

2016-02-13 15:06 GMT+02:00 Anam Hossain [email protected]:

@meliksahk https://github.com/meliksahk are you using anam/phantomjs-linux-x86-binary? if not please read the following:

https://github.com/anam-hossain/phantommagick#binary

— Reply to this email directly or view it on GitHub https://github.com/anam-hossain/phantommagick/issues/10#issuecomment-183662336 .

Melikşah Said KUTLU Yazılım Projeleri Sorumlusu *EMATO ELEKTRONİK *

meliksahk avatar Feb 15 '16 14:02 meliksahk

I have also experienced this problem, but I fix it by making the binary file (phantomjs) executable, I'm using vagrant with ubuntu 14.04

redsketch avatar Apr 16 '16 04:04 redsketch

Hi, same problem

I've also set path in this way use Anam\PhantomLinux\Path; ->setBinary(Path::binaryPath())`

phantomjs has 755 permission I've installed it with composer

mabuonomo avatar Jul 07 '17 09:07 mabuonomo

I fix the problem

I've installated phantomjs on Centos7 in /user/bin/phantomjs

Change these line in Runner.php // if (! shell_exec(escapeshellcmd("which {$binary}"))) { // return false; // } if (! shell_exec(escapeshellcmd("{$binary}"))) { // echo 'no linux3'; return false; }

And set the new Binary ->setBinary('/usr/bin/phantomjs')

mabuonomo avatar Jul 07 '17 13:07 mabuonomo

I installed phantomjs and now I am getting a pdf, but none of my local fonts are rendering. Is there really no way to get this working without loading in a different package of phantomjs?

cdentesting avatar Jun 28 '18 01:06 cdentesting

Same issue. Are you fixed the issue?

SelvaSweet avatar May 15 '19 10:05 SelvaSweet

I found that my code does not work in one server but it does in others with the same settings. Centos 7 with WHM/cpanel

The following function does not return true in Runner.php

if (! shell_exec(escapeshellcmd("which {$binary}"))) {

            return false;

}

Commenting the line returning false makes it work, because the binary exists and it is located properly.

So it looks like this issue has to be with something executing shell_exec or escapeshellcmd via laravelm, what could it be? using php-fpm these functions are enable and the user is in the wheel group as well.

Thanks for your help

DanielF93Dev avatar Jun 17 '19 17:06 DanielF93Dev

Hi,

I'm also having the same problem, I'm using Laravel 5.7 in windows 10. I first installed via composer:

composer require josh/laravel-phantomjs then composer require anam/phantommagick after it I added the lines to the aliases and facades. and when I call this code:

$conv = new \Anam\PhantomMagick\Converter();
        $conv->source('http://google.com')
        ->toPdf()
        ->save('/your/destination/path/google.pdf');

I get an error: "Binary does not exist" in \vendor\anam\phantommagick\src\Runner.php

    public function pickBinary()
    {
        if ($this->binary != 'phantomjs') {
            if (! $this->verifyBinary($this->binary)) {
                throw new Exception('Binary does not exist');
            }
 
            return $this->binary;
        }
 
 
        if (! $this->verifyBinary($this->binary)) {
 
            if (! $this->verifyBinary($this->getAlternateBinary())) {
                throw new Exception('Binary does not exist');
            }
 
            $this->binary = $this->getAlternateBinary();
        }
 
        return $this->binary;
    }

How can I fix it?

royo1987 avatar Nov 05 '19 01:11 royo1987

change binary file permission to 777

mahdi4187 avatar Jan 16 '20 10:01 mahdi4187