Home:ALL Converter>File writing not working in PHP/MAFFT when executed in a web page

File writing not working in PHP/MAFFT when executed in a web page

Ask Time:2014-07-19T03:05:00         Author:Ryan

Json Formatter

I am working on a web based project that executes a program on the server called MAFFT. MAFFT takes as arguments an input file and a file to write the output to.

    mafft in > out

I have a php page that calls this:

    <?php
        shell_exec("mafft in > out);
    ?>

I have also tried a shell script (scr.sh):

    #!/bin/bash
    mafft in > out

Then:

    <?php
        shell_exec("sh ./scr.sh");
    ?>

When I run either the shell script or the php file from the command line

    php something.php

it works exactly as it is supposed to, but when I just navigate to the page in a web browser, it creates the out file but does not write to it (even if I change the output file perm to 777).

The in/out files can be pretty large since this is sequence alignment stuff, but I am testing with less than 200 character files.

Is there something that I am missing here or is it just not possible to do this from a web page?

Thanks, Ryan

Author:Ryan,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/24832067/file-writing-not-working-in-php-mafft-when-executed-in-a-web-page
yy