Problem using Graphviz with XAMPP [SOLVED]

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Problem using Graphviz with XAMPP [SOLVED]

Postby cristianpark » 29. April 2010 17:41

Hi guys, I'm trying to use DOT command from a PHP script this way:

Code: Select all
$cmdline="/usr/local/bin/dot -v -Tpng /opt/lampp/htdocs/sgi/tmp/dia/_tmp_49441291c2a0f43f3330a7bc70df2d4e -o /opt/lampp/htdocs/sgi/tmp/dia/_tmp_49441291c2a0f43f3330a7bc70df2d4e.png 2>/opt/lampp/htdocs/sgi/tmp/dia/salida";
         
shell_exec($cmdline);
When I execute the command from the terminal, the resulting image is fine, but when I do it from PHP y get 0 bytes image.

I see that $LD_LIBRARY_PATH is set to (:/opt/lampp/lib::/opt/lampp/lib:) in xampp execution but it has no value on the terminal

The outputs of the command:
- Executing command from terminal (the image produced is fine): http://pastebin.com/JxarhhV0
- Executing command from PHP (the image produced is 0 bytes lenght): http://pastebin.com/wZgYHhHg

The issue is on the last line of the output:
Code: Select all
/usr/local/bin/dot: symbol lookup error: /usr/lib/libcairo.so.2: undefined symbol: FT_Library_SetLcdFilter


This is the information about the platform I use
- OS: GNU/Linux Ubuntu 9.10
- Graphviz - DOT: dot - graphviz version 2.26.3 (20100126.1600). Lastest (compiled from source). But the problem occours as well with graphviz installed from repos
- Webserver: Xampp 1.7.1 (I need to use PHP 5.2.9)
- The user in apache is my system user, so I don't have permission issues

Thanks for your help
cristianpark
 
Posts: 5
Joined: 29. April 2010 17:33

Re: Problem using Graphviz with XAMPP [SOLVED]

Postby cristianpark » 29. April 2010 20:45

Hi, I was able to fix the problem thanks to the help of the guys from Graphviz maillist [1]. They point me that the error was happening because of the libraries used by Xampp. The /usr/local/bin/dot: symbol lookup error: /usr/lib/libcairo.so.2: undefined symbol: FT_Library_SetLcdFilter problem was related to the libfreetype that was invoked from the PHP Script.

The suggestion of the guys of Graphviz was to do a
Code: Select all
ldd /usr/local/lib/graphviz/libgvplugin_pango.so.6 
from bash [2] and from the PHP script [3]. On the output from PHP, we can see this line
Code: Select all
libfreetype.so.6 => /opt/lampp/lib/libfreetype.so.6 (0x003ac000)
instead of
Code: Select all
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x003ac000)
from the bash output.

So what I did to fix the problem was to make a symlink (two because libz has the same issue)
Code: Select all
ln -s /usr/lib/libfreetype.so.6 /opt/lampp/lib/libfreetype.so.6
ln -s /usr/lib/libz.so.1 /opt/lampp/lib/libz.so.1


I hope this can help anyone who faces this in the future.

By the way, I'd like to ask something: Does xampp work with his own set of libraries? how does this work? is easy to face a problem like this with another program that uses system libraries? any info about it will be appreciated.

Thanks

[1] http://old.nabble.com/Problems-using-DO ... 65815.html
[2] http://pastebin.com/EjPffaaq
[3] http://pastebin.com/RcUjRGF3
cristianpark
 
Posts: 5
Joined: 29. April 2010 17:33


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 26 guests