I have meshlab installed in my machine running Ubuntu 14.04 OS. I can access it from command line using meshlabserver
command. But problem arises whenever I try to call it from a php script using the command
<?php
system('meshlabserver 2>&1');
?>
It shows the error meshlabserver: cannot connect to X server
. After going through a few websites I did the following things:
I moved the meshlabserver
executable from /usr/bin
to /usr/local/bin
and gave it executable permissions using
sudo chmod a+x meshlabserver
But when I ran the whoami
command from my php script (calling the meshlabserver
), it showed www-data
. So I gave executable permissions for all users to the meshlabserver
using
sudo chmod 777 /usr/local/bin/meshlabserver
But still it is showing the same meshlabserver: cannot connect to X server
error. meshlabserver
comamnd is working fine when ran from the command line.
I really need to call meshlab
from the php script for my website. Thus any help would be highly appreciated. Thanks in advance.