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

Basic Script not running: Use failing 500 error #156

Open
iamattamai opened this issue Jan 26, 2017 · 6 comments
Open

Basic Script not running: Use failing 500 error #156

iamattamai opened this issue Jan 26, 2017 · 6 comments

Comments

@iamattamai
Copy link

I'm not consulting you without having spent a day on this trying every combination I could think of.
I've installed and reinstalled using the jakoch loader without error.
All the directories seem in place in the vendor and bin directories.
The client file exists.
I can run PhantomJS scripts from the command line in PUTTY successfully.
PHP is up and running on my AWS instance, other programs in PHP run fine.
However, when I run your basic example below I get a 500 error consistently. There is no other error output.
It would appear that I have a configuration issue that is preventing the Client instance from being created.
Your help is greatly appreciated.

@iamattamai
Copy link
Author

The "basic example" referenced above is as follows:

getMessageFactory()->createRequest('http://jonnyw.me', 'GET'); /** * @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(); }

@selm0
Copy link

selm0 commented Jan 30, 2017

How did you create your client?
Instantiating it with $client = Client::getInstance(); is working for me.
Otherwise information about the error would be helpful. Have a look into the php log file or debug your code to identify the exact error message.

Maybe you can get additional info by having a look at the log by $client->getEngine()->getLog().

@nemanjam
Copy link

nemanjam commented Feb 11, 2017

Yes, I can confirm the basic example is not working, php process is stuck forever.

public static function render_pic()
{
	$client = Client::getInstance();
	$client->getEngine()->setPath(base_path().'/bin/phantomjs.exe');
	$request  = $client->getMessageFactory()->createCaptureRequest('http://jonnyw.me');
	$response = $client->getMessageFactory()->createResponse();
	$file = storage_path('app/pic.png');
	$request->setOutputFile($file);
	$client->send($request, $response);
}

It gets stuck here $result = stream_get_contents($pipes[1]); jonnyw\php-phantomjs\src\JonnyW\PhantomJs\Procedure\Procedure.php line 113.

@iamattamai
Copy link
Author

iamattamai commented Feb 14, 2017 via email

@nemanjam
Copy link

Post the solution.

@iamattamai
Copy link
Author

I don't know what the solution was in the end inasmuch as I didn't solve it myself. I imaged my AWS/EC2 instance and will just clone it for future projects to avoid the pain. Idea: There might actually be a market for pre-configured AWS templates with everything already in place, but that wouldn't be from me.

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