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

Graphp not working at all #31

Closed
codemann8 opened this issue Jan 26, 2019 · 1 comment
Closed

Graphp not working at all #31

codemann8 opened this issue Jan 26, 2019 · 1 comment
Labels

Comments

@codemann8
Copy link

codemann8 commented Jan 26, 2019

I've been trying for hours to install this library and get a simple example to load. I installed this using composer using the one-line require statement listed on your main GitHub page. I'm getting an error:

Fatal error: Uncaught exception 'Fhaculty\Graph\Exception\UnexpectedValueException' with message 'Unable to invoke "dot" to create image file (code 127)' in /home/somedirectory/vendor/graphp/graphviz/src/GraphViz.php:207 Stack trace: #0 /home/somedirectory/vendor/graphp/graphviz/src/GraphViz.php(142): Graphp\GraphViz\GraphViz->createImageFile(Object(Fhaculty\Graph\Graph)) #1 /home/somedirectory/graph2.php(18): Graphp\GraphViz\GraphViz->createImageData(Object(Fhaculty\Graph\Graph)) #2 {main} thrown in /home/somedirectory/vendor/graphp/graphviz/src/GraphViz.php on line 207

using this code:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

include 'vendor/autoload.php';

$graph = new Fhaculty\Graph\Graph();

$blue = $graph->createVertex( 'blue' );
$blue->setAttribute( 'graphviz.color', 'blue' );

$red = $graph->createVertex( 'red' );
$red->setAttribute( 'graphviz.color', 'red' );

$edge = $blue->createEdgeTo( $red );
$edge->setAttribute( 'graphviz.color', 'grey' );

$graphviz = new Graphp\GraphViz\GraphViz();
$data = $graphviz->createImageData( $graph );
$image = imagecreatefromstring( $data );
header( 'Content-Type: image/png' );
imagepng( $image );
imagedestroy( $image );
?>

Any ideas what I'm doing wrong?

@clue clue added the question label Jan 27, 2019
@clue
Copy link
Member

clue commented Jan 27, 2019

Fatal error: Uncaught exception 'Fhaculty\Graph\Exception\UnexpectedValueException' with message 'Unable to invoke "dot" to create image file (code 127)'

@codemann8 Thank you for reporting and welcome to GraPHP! 🎉

This error means that you do not have GraphViz installed (the dot executable is part of the GraphViz package). See also the install instructions. On Debian/Ubuntu-based system you may simply install it like this:

$ sudo apt install graphviz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants