2017-01-17 6 views
0

Ich bin Anfänger in der Programmierung. Ich habe gerade mein Debian und installiert folgende PaketeWie installiert man Graphviz auf Debian 7.7?

dpkg -l | grep graph 
ii graphviz       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools 
ii libart-2.0-2:amd64     2.3.21-2      amd64  Library of functions for 2D graphics - runtime files 
ii libcairo2:amd64     1.12.2-3      amd64  The Cairo 2D vector graphics library 
ii libcdt4       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - cdt library 
ii libcgraph5       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - cgraph library 
ii libgraph4       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - graph library 
ii libgraphviz-dev     2.26.3-14+deb7u2    amd64  graphviz libs and headers against which to build applications 
ii libgvc5       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - gvc library 
ii libgvpr1       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - gvpr library 
ii libpathplan4      2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - pathplan library 
ii libxdot4       2.26.3-14+deb7u2    amd64  rich set of graph drawing tools - xdot library 
ii openssl       1.0.1e-2+deb7u12    amd64  Secure Socket Layer (SSL) binary and related cryptographic tools 

habe ich auch Programm folgende mit Graphviz zu starten:

<?php 
require_once 'Image/GraphViz.php'; 

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

Aber was ich bekommen ist:

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

Bitte lassen Sie mich wissen Wie geht man mit diesem Problem um?

Grüße

Antwort

0

Sie müssen die PHP-Bindings für GraphViz installieren. Ich habe nicht ein Debian-Bild, dieses zu versuchen, aber versuchen:

sudo apt-get install libgv-php5 

Wenn das nicht funktioniert, dann versuchen:

sudo apt-cache search libgv | grep -i php 

UPDATE: Der obige Code geben arbeitet gegen einen sauberen Debian 7 Bild nach den folgenden Befehlen:

sudo apt-get update 
sudo apt-get install apache2 libapache2-mod-php5 libgv-php5 graphviz vim php-pear 
sudo pear install Image_GraphViz 

# Copy the file above to test.php 
php5 test.php 
+0

noch funktioniert nicht – Mahdi

+0

Sind Sie sicher, dass PHP funktioniert? Wenn Sie diese Datei nur ersetzen: ' ', siehst du nur' Hallo.'? – Scovetta

+0

Ja, mein PHP funktioniert! – Mahdi

Verwandte Themen