gpt4 book ai didi

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

转载 作者:可可西里 更新时间:2023-11-01 12:38:35 26 4
gpt4 key购买 nike

使用 1and1 linux 共享主机,

我已经安装了:

PHP 版本 7.0.27PHP PhantomJS 2.1.1

PHP PhantomJS 所有值都为空

每当我提出请求时:

$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);
}

我有一堆空值,而且 URL 没有被 phantomJS 处理...

要求:

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 - Created and will store cookies in: "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/homepages/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 has crashed. Please read the bug reporting guide at http://phantomjs.org/bug-reporting.html and file a bug report. Segmentation fault " int(0) NULL

编辑:

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

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

如何使用 Composer 安装它?

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

感谢所有帮助。

最佳答案

检查您的系统是否运行 SELinux(您可以使用 sestatus 检查)——它可以(而且它会)尝试损害 PhantomJS,它看起来就是这样。

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

关于php - 在共享主机上安装 PhantomJS (1and1),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48980574/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com