Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What I want to do is install GraphViz for PHP on Ubuntu.

I tried pear install Image_GraphViz, it installed but does not work for me.

Then I tried downloading the file from here.

File name : libgv-php5_2.32.0-1~raring_amd64.deb When I run the file it says dependency is not satisfiable libgraphviz4.

All I want to do is run the code below which is from their documentation. Unfortunately I can not find GraphViz.php to download.

require_once 'GraphViz.php';

$gv = new Image_GraphViz();
$gv->addEdge(array('wake up'        => 'visit bathroom'));
$gv->addEdge(array('visit bathroom' => 'make coffee'));

How can I fix this issue? Where can I download GraphViz.php

share|improve this question

migrated from Aug 26 '13 at 18:48

This question came from our site for professional and enthusiast programmers.

This should probably be on Server Fault – Mike Aug 22 '13 at 5:54
No, this does not belong on Server Fault. Server Fault is for professional sysadmin questions. Getting PEAR modules working is way, way out of scope for SF, and is perfectly on topic on SO. – Charles Aug 22 '13 at 23:22
@MartinSchröder, so? It's still on-topic here. – Charles Aug 26 '13 at 15:57
up vote 2 down vote accepted

Just install the libgv-php5 Install libgv-php5 package:

PHP5 bindings for graphviz

Graphviz is a set of graph drawing tools. See the description of the graphviz package for a full description.

This package contains the PHP5 bindings.

Using your favourite package management, e.g. apt-get, do:

sudo apt-get install libgv-php5

This should install the Graphviz for PHP in the paths used by the Ubuntu packaged version of PHP (automatically enabled in the php.ini .d directory).

You will then have to change your require_once statement to match the Ubuntu packaged version. From the manpage:


Also don't forget to restart your webserver if you're running PHP as a module.

share|improve this answer
Still I get Fatal error: Class 'Image_GraphViz' not found in /var/www/ – Techie Aug 27 '13 at 3:30
@Dasun How about replacing your require_once with require_once 'libgv-php5/gv.php'; ? – gertvdijk Aug 27 '13 at 7:58

You should install the graphviz package via apt:

$ sudo apt-get install graphviz

Then Image_Graphviz is able to use the dot command that is provided by graphviz.

share|improve this answer
Where can I find the GraphViz.php file to be included? – Techie Aug 22 '13 at 8:22
@Dasun if you correctly ran the pear command, then the file will be in your include path already. – Charles Aug 22 '13 at 23:22
Still I get Fatal error: Class 'Image_GraphViz' not found in /var/www/ – Techie Aug 27 '13 at 3:30
Follow the PEAR setup instructions: – cweiske Aug 27 '13 at 4:04

GraphViz.php is the file contained in the Image_GraphViz package. It would likely be in a folder named Image_GraphViz. Therefore include the full path in your require_once statement. The file defines the Image_GraphViz class that provides an interface to the actual GraphViz system (installed separately).

share|improve this answer

At first reinstall pear:

php go-pear.phar

After that install graphviz via pear:

sudo pear install Image_GraphViz

That's all.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.