-
Notifications
You must be signed in to change notification settings - Fork 431
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
ProcedureFailedException #19
Comments
Hi, can you post a snippet of the code that you are using to make the request? |
this is your examples/basic-request.php require '../vendor/autoload.php'; |
Can you run this and let me know what it outputs/throws: require '../vendor/autoload.php';
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
var_dump($client->getCommand()); |
file structure: http://i.imgur.com/FCwgdPL.png
Result:
|
That means it can't find your phantomjs executable or it doesn't have permissions to execute it. It could be that you are executing the script from somewhere other than the directory above your bin dir, which is where it is looking for the phantomjs executable. Make sure you're using v3.1+ and try the following: require 'vendor/autoload.php';
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$client->setBinDir('/absolute/path/to/your/bin/directory');
var_dump($client->getCommand()); Make sure the path is absolute to your bin directory. If that doesn't work then check that the user you are running your script as has permissions to execute the files in your bin folder. |
Hey Jonnyw, Some quick checks in php says that phantomjs.exe is writable. In your previous version I had to manually append .exe on the phantomjs location in client.php......maybe that's the trouble? Code:
|
@moe1507, the same I did. |
@scratcher28 , Where do I append .exe. I haven't found it yet in the new version(3.1). |
You can do it a couple of ways. If you are running the script from the parent directory of your bin folder, just set the PhantomJS path as follows: require 'vendor/autoload.php';
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$client->setPhantomJs('bin/phantomjs.exe');
var_dump($client->getCommand()); Or you can set the bin dir separately and then set the PhantomJS executable: require 'vendor/autoload.php';
use JonnyW\PhantomJs\Client;
$client = Client::getInstance();
$client->setBinDir('/absolute/path/to/your/bin/dir');
$client->setPhantomJs('phantomjs.exe');
var_dump($client->getCommand()); The second option is probably recommended as it guarantees that the client can find your bin dir. I will update the install documentation with this information. Ideally it would be nice to automatically set the extension based on the installed system. I will look into it. |
tried the above....still not executable. test.php
result: |
when calling sprinf(): $this->phantomJs is empty... ...
|
That's odd that I guess the root of your problem is down to the fact that you are using backslashes. Have you thought about using forward slashes so that your code is portable across across different environments? My understanding is that Windows supports forward slashes. |
Faced same issue. Fixed it using following code $client->getEngine()->setPath(dirname(FILE).'/bin/phantomjs.exe'); |
This
fix the issue for me. |
Fatal error: Uncaught exception 'JonnyW\PhantomJs\Exception\ProcedureFailedException' with message 'Error when executing PhantomJs procedure "default" - File does not exist or is not executable: bin/phantomjs'
I followed the instructions and manually created my bin folder in the project root. phantomjs.exe, phantomloader, and phantomloader.bat were installed successfully. Not sure why this cannot execute. In your previous version I remember manually changing the location from phantomjs to phantomjs.exe in client.php to work with Wndows. Manually setting $client->setBinDir in examples/basic-request.php results in the same error.
The text was updated successfully, but these errors were encountered: