Problem working with graphviz in php

I want to create graph in php using graphviz and i am working on windows. This is the sample code i am using :

<?php
require_once 'Image/GraphViz.php';
error_reporting(E_ALL);
$gv = new Image_GraphViz();
$gv->addEdge(array('wake up'        => 'visit bathroom'));
$gv->addEdge(array('visit bathroom' => 'make coffee'));
$gv->image();
?>

But when i run this code in browser i get the following errors. Can anybody tell me what i am doing wrong with it.

Strict Standards: Non-static method System::mktemp() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\graphviz\graph.php on line 1005

Strict Standards: Non-static method System::_parseArgs() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 393

Strict Standards: Non-static method Console_Getopt::getopt2() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 84

Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 75

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 109

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 394

Strict Standards: Non-static method System::tmpdir() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 408

Strict Standards: Non-static method System::mkDir() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 411

Strict Standards: Non-static method System::_parseArgs() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 247

Strict Standards: Non-static method Console_Getopt::getopt2() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 84

Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 75

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 109

Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 162

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Console\Getopt.php on line 167

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 248

Strict Standards: Non-static method PEAR::registerShutdownFunc() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\System.php on line 429

Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in C:\xampp\htdocs\graphviz\graph.php on line 204

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method System::_removeTmpFiles() should not be called statically in C:\xampp\php\pear\PEAR.php on line 774

Strict Standards: Non-static method System::rm() should not be called statically in C:\xampp\php\pear\System.php on line 448

Strict Standards: Non-static method System::_parseArgs() should not be called statically in C:\xampp\php\pear\System.php on line 201

Strict Standards: Non-static method Console_Getopt::getopt2() should not be called statically in C:\xampp\php\pear\System.php on line 84

Strict Standards: Non-static method Console_Getopt::doGetopt() should not be called statically in C:\xampp\php\pear\Console\Getopt.php on line 75

Strict Standards: Non-static method PEAR::isError() should not be called statically in C:\xampp\php\pear\Console\Getopt.php on line 109

Strict Standards: Non-static method Console_Getopt::_parseShortOption() should not be called statically in C:\xampp\php\pear\Console\Getopt.php on line 166

Strict Standards: Non-static method PEAR::isError() should not be called statically in C:\xampp\php\pear\Console\Getopt.php on line 167

Strict Standards: Non-static method PEAR::isError() should not be called statically in C:\xampp\php\pear\System.php on line 202

Strict Standards: Non-static method System::_multipleToStruct() should not be called statically in C:\xampp\php\pear\System.php on line 212

Based on the error messages,

Based on the error messages, your problem has nothing specifically to do with graphviz but is some larger problem
as regards pear, php and your browser. Someone reading this forum might respond, but you might find it useful to
post your problem on stackoverflow or a forum related to pear or php.

I have used this code to

I have used this code to check pear, it returns bool(true).

<?php

require_once 'PEAR.php';
var_dump(class_exists('PEAR', false));
?>

I have personally write static with all the non-static methods, now errors are gone. But still no graph is appearing

Where were the errors coming

Where were the errors coming from? They must all be coming from some other part of pear, as GraphViz.php doesn't
contain any calls to getopt2, mkdir, tmpdir, etc.

GraphViz.php provides a simple wrapper for creating and viewing graphs in a browser. To get the actual image, the
server just calls dot or neato on the constructed graph. So a first check would be that the server machine has dot
installed and that dot is in the server's path.

As suggested previously, the GraphViz.php software is not ours. You should probably contact the authors or users of that.

Recent comments