在共享主机(1and1)上安装PhantomJS

问题描述 投票:8回答:1

使用1and1 linux共享主机,

我安装了:

PHP版本7.0.27 PHP PhantomJS 2.1.1

PHP PhantomJS的所有值都为null

每当我提出请求时:

$client = Client::getInstance();

$client->getEngine()->setPath($main_path.'core/composer/bin/phantomjs');
$client->getEngine()->addOption('--ssl-protocol=any');
$client->getEngine()->addOption('--ignore-ssl-errors=true');
$client->getEngine()->addOption('--web-security=false');
$client->getEngine()->addOption('--debug=true');
$client->getEngine()->addOption('--local-to-remote-url-access=true');

$request = $client->getMessageFactory()->createRequest("http://luclaverdure.com");
$response = $client->getMessageFactory()->createResponse();

$client->send($request, $response);
var_dump($request);
var_dump($response);

if($response->getStatus() === 200) {
    $resp = $response->getContent();
    var_dump($resp);
}

我有一堆空值,并且phantomJS无法处理URL ...

请求:

object(JonnyW\PhantomJs\Http\Request)#113 (12) {
    ["type":protected]=> NULL
    ["headers":protected]=> array(0) {}
    ["settings":protected]=>
      array(1) {
        ["resourceTimeout"]=>
        int(5000)
      }
    ["cookies":protected]=>
      array(2) {
        ["add"]=>
        array(0) {
        }
        ["delete"]=>
        array(0) {
        }
      }
    ["data":protected]=>
      array(0) {
      }
    ["url":protected]=>
      string(59) "http://luclaverdure.com"
    ["method":protected]=>
      string(3) "GET"
    ["timeout":protected]=>
      NULL
    ["delay":protected]=>
      int(0)
    ["viewportWidth":protected]=>
      int(0)
    ["viewportHeight":protected]=>
      int(0)
    ["bodyStyles":protected]=>
      array(0) {
      }
}

响应:

object(JonnyW\PhantomJs\Http\Response)#263 (9) {
    ["headers"]=>
      NULL
    ["status"]=>
      NULL
    ["content"]=>
      NULL
    ["contentType"]=>
      NULL
    ["url"]=>
      NULL
    ["redirectURL"]=>
      NULL
    ["time"]=>
      NULL
    ["console"]=>
      NULL
    ["cookies"]=>
      NULL
}

它永远不会返回内容

请帮忙

编辑:日志:

string(1413)“2018-02-25T22:31:25 [DEBUG] CookieJar - 创建并将cookie存储在:”cookies.txt“1 0x1b67967 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x1b67967] 2 0x1baaaf5 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x1baaaf5] 3 0x198c463 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x198c463] 4 0x1ab3982 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x1ab3982] 5 0x79abb9 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x79abb9] 6 0x76b6f9 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x76b6f9] 7 0x750a5d / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x750a5d] 8 0x41cd89 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x41cd89] 9 0x41f5c4 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x41f5c4] 10 0x415b86 / kunden / homep年龄/ 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x415b86] 11 0x2b1fc0917b45 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x2b1fc0917b45)12 0x4176a1 / kunden / homepages / 0 / d220355082 / htdocs / bitme / core / composer / bin / phantomjs()[0x4176a1] PhantomJS崩溃了。请阅读http://phantomjs.org/bug-reporting.html上的错误报告指南并提交错误报告。分段错误“int(0)NULL

编辑:

如果我用最新的下载替换phantomJS,

我得到libicui18n.so.55缺少依赖

如何使用Composer安装它?

请注意,这需要安装在共享主机上,因此我没有root / sudo访问权限

所有帮助表示赞赏。

php phantomjs composer-php shared-hosting php-phantomjs
1个回答
2
投票

检查你的系统是否运行SELinux(你可以用sestatus检查) - 它可以(它会)试图伤害PhantomJS,它看起来就像那样。

查看phantomjs.org/troubleshooting上的“SELinux”部分以获取官方解决方案。

© www.soinside.com 2019 - 2024. All rights reserved.