Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR - Fatal: No such file or directory; did you install phantomjs? #54

Open
alexanderpavlovru opened this issue Jan 27, 2018 · 2 comments

Comments

@alexanderpavlovru
Copy link

When I run the script in console php index.php it works well.
But if I run it via browser http://localhost/ or via curl in console curl localhost it gives me an error
ERROR - Fatal: No such file or directory; did you install phantomjs?

My nginx config is simple

server {
    listen 0.0.0.0:80;

    root /var/www/html;

    location / {
        index index.php index.html;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
    }
}

phantomjs and casperjs are installed

ls -la /usr/local/bin
casperjs -> ../lib/node_modules/casperjs/bin/casperjs
phantomjs -> /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs

It is all in docker container.

Any ideas?

@nbah1990
Copy link

$phantomjsPath = 'node_modules/phantomjs/lib/phantom/bin/phantomjs.exe';
putenv('PHANTOMJS_EXECUTABLE=' . $phantomJsPath);

It works for me.

@crouti
Copy link

crouti commented Dec 21, 2018

Does not work for me on ubuntu 16 or 18, any idea ?
For me

casperjs -> ./node_modules/casperjs/bin/casperjs
phantomjs -> ./node_modules/phantomjs/bin/phantomjs

I have tried many things, last is

$command = "chmod +x ".$phantomJSExecutablePath."*";
$cmdRet = exec($command);
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
$command = "export PHANTOMJS_EXECUTABLE=".$phantomJSExecutablePath."phantomjs";
self::getLogger()->debug($command);
$cmdRet = exec($command);
$systemPath = getenv('PATH');
putenv("PATH=" .$systemPath. ':'.$phantomJSExecutablePath);
$command = "ln -s ".$phantomJSExecutablePath."/phantomjs /usr/local/bin/phantomjs";
$cmdRet = exec($command);

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants