How to Run IDTFConverter on Web Server

2014-02-01
2014-02-10
  • Riccardo Volpe
    Riccardo Volpe
    2014-02-01

    Hello,
    I successfully compiled IDTFConverter on a Linux 32bit platform, and it's my purpose use it on a webserver.
    I tried in this way:

    (content of test.php file)

    <?php
    exec('./jmol -o -s ./idtf_generator.spt -n');
    exec('../IDTF2U3D/IDTF/IDTFConverter -input ../test/CID_4878.idtf -output ../test/CID_4878.u3d -pq 1000 -tcq > 1000 -nq 1000 -dcq 1000 -scq 1000 -gq 1000 -aq 1000 -eo 65535 -tq 100');
    ?>
    

    If I call that php page from the browser (with running local webserver, XAMPP), it generates idtf file into the test folder (first exec), but not the u3d file (second exec); if I launch, instead, the test.php from shell with command:

    php ./test.php
    

    it generates the u3d too. The same thing if I use a cgi-script: the process skips the IDTFConverter command. I setted the permission of cgi-script and IDTFConverter to 755. The u3d output is in the same folder ("test", which has 777 as permissions) of the generated idtf file.

    I can't understand. I don't know if I need to set something special in the Apache config file for the IDTFConverter; i tried to use both relative and absolute paths for command, without success. I don't know if I need to create something like the .bash_profile file in the home of my local webserver, indicating the absolute paths of the portable IDTFConverter.

    I hope somebody can solve me. Thanks a lot for your help,

    Riccardo

     
    Last edit: Riccardo Volpe 2014-02-01
  • If the source of the problem is not a command-line typo (-tcq > 1000 looks fishy),
    most likely IDTFConverter has trouble finding U3D libraries it needs to do real work.
    Redirect its console output to some file and see what it complains about.
    Try to trace (strace) the IDTFConverter to see where it looks for U3D libraries and compare that to where they really are.

     
    Last edit: Michail Vidiassov 2014-02-01
    • Riccardo Volpe
      Riccardo Volpe
      2014-02-01

      Thanks a lot, Michail, for your reply.

      Sorry, that "-tcq > 1000" is been an error writing in this topic; the command is written correctly in the test.php file.

      There is something to strange, but good to see and full of happiness:
      perhaps for a command given trying to enable apache user in my local server; I read this pages:

      Citing:

      << Users
      We have to think of who will want access to the folders.
      There are two users to consider.

      The first is the Slice user - in this case my username is 'demo'.
      It is in demo's home directory that the public_html directory is placed.

      Secondly is the Apache user. On Debian based systems it is usual for Apache
      to be 'www-data' and be in the 'www-data' group. Other Linux distributions
      use the user 'nobody' or even 'apache'. >>

      In my case I used the following command to have a list of groups on my distro (Fedora 20 LXDE), to see if I have "www-data" or something else group:

      cut -d: -f1 /etc/group
      

      I found the apache "group", which is an "user" too (I used the command "cat /etc/passwd"); so I gave the commands (taken from this website):

      sudo chown -R Riccardo:apache htdocs
      sudo chmod -R g+s htdocs
      

      Now, if I launch the two commands with PHP, all is fine :)...I obtain my idtf and the u3d file too!!

      Different if, instead of to launch the commands by PHP, I directly open a CGI script (written in python) into the browser, to perform a list of steps: the IDTFConverter command is skipped. If I instead execute the same steps all by PHP, all is OK!

      I don't know why, but for now, via PHP, would be ok, but not if I use the cgi script alone.

      Many thanks for your suggestion and support, Michail!! I didn't know "strace"; I installed it and read its man; which is the better set of options to use it? Is this correct and sufficient:

      strace -o./idtfconv.txt <IDTFConverter command with its options>
      

      I have not tested it yet, but it's good to know.

      Many greetings, and Thanks again,

      have a nice day,

      Riccardo

       
  • Riccardo Volpe
    Riccardo Volpe
    2014-02-01

    I posted three times the same reply, because there wasn't the "Post awaiting moderation" note in my two previous replies.

    Sorry,
    Riccardo