2016-06-17 2 views
0

를로드하지,하지만 난PHPPhantomJS 내가 페이지를로드 PHP PhantomJS를 사용하는 것을 시도하고있다 PhantomJS 모듈

Fatal error: Uncaught JonnyW\PhantomJs\Exception\ProcedureFailedException: Error when executing PhantomJs procedure - File does not exist or is not executable: bin/phantomjs in /Volumes/WWW ROOT/namechase/www/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php:138 
Stack trace: 
#0 /Volumes/WWW ROOT/namechase/www/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Client.php(162): JonnyW\PhantomJs\Procedure\Procedure->run(Object(JonnyW\PhantomJs\Http\Request), Object(JonnyW\PhantomJs\Http\Response)) 
#1 /Volumes/WWW ROOT/namechase/www/crawling.php(30): JonnyW\PhantomJs\Client->send(Object(JonnyW\PhantomJs\Http\Request), Object(JonnyW\PhantomJs\Http\Response)) 
#2 {main} 
    thrown in /Volumes/WWW ROOT/namechase/www/vendor/jonnyw/php-phantomjs/src/JonnyW/PhantomJs/Procedure/Procedure.php on line 138 

이 단지 내 테스트 도메인 중 하나, 그리고 다른 한편으로 발생하는 오류를 얻을.

두 도메인에서 실행중인 코드는 동일하지만 두 테스트 베드 중 하나에서 작동하지 않습니다. 둘 다 서로 다른 가상 호스트를 사용하는 동일한 시스템에서 실행되지만 하나만 오류를 리턴합니다.

require $_SERVER['DOCUMENT_ROOT'] . '/vendor/autoload.php'; 

echo '<pre>'; 
use JonnyW\PhantomJs\Client; 

$client = Client::getInstance(); 
$delay = 5; // 5 seconds 

$request = $client->getMessageFactory()->createRequest('https://google.com', 'GET'); 
$request->setDelay($delay); 
/** 
* @see JonnyW\PhantomJs\Http\Response 
**/ 
$response = $client->getMessageFactory()->createResponse(); 

// Send the request 
$client->send($request, $response); 

if($response->getStatus() === 200) { 

    // Dump the requested page content 
    echo $response->getContent(); 
} 

나는

"config": { 
    "bin-dir": "/usr/local/bin" 
} 

를 사용하여 composer.json 파일에 phantomjs의 경로를 설정 시도했지만이 당신의 패키지를 설치하는 차이를

답변

0

실행할 작곡가을하지 않는 것 PhantomJS-Installer 스크립트는 PhantomJS를 가져 와서 프로젝트의 /bin 폴더에 설치합니다.

수동으로 설치하거나 이동할 때를 제외하고는 절대로 /usr/local/bin에 착륙하지 않습니다.

다음 오류 메시지가 나타납니다. File does not exist or is not executable: bin/phantomjs.

먼저 파일을 정확하게 가져 와서 bin 폴더에 설치했는지 확인합니다. 파일이 프로젝트의 bin 폴더에 설치되어 있지 않으면 설치 프로그램 스크립트가 작성자 실행 중 오류를 표시해야합니다.

두 번째로 파일 사용 권한을 확인합니다. 일반적으로 설치 프로그램은이를 처리하지만 실행 플래그 +x이 설정되어 있으면 살펴 봅니다.

관련 문제