Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

<?php
require_once 'GraphViz.php';

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

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

share|improve this question

migrated from stackoverflow.com 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
2  
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

3 Answers 3

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:

#!/usr/bin/php
<?
include('libgv-php5/gv.php');
...
?>

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
4  
@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: pear.php.net/manual/en/installation.checking.php –  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

Your Answer

 
discard

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.