php exec to C program that writes file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • chmod000@gmail.com

    php exec to C program that writes file

    Hello,
    I'm trying to use the exec() call in php to run a program that I've
    written and compiled from C. This program attempts to create a new
    file and write data into it.

    If I simply run the program from the shell, it writes the file no
    problem. If i run the program through an exec call in a php script,
    however, the program executes but it seems to not have the correct
    permissions to be able to write the file.
    Can anyone help me? I've been stumped here for awhile.

    thanks!
    alex

  • Tim Van Wassenhove

    #2
    Re: php exec to C program that writes file

    On 2005-01-31, chmod000@gmail. com <chmod000@gmail .com> wrote:[color=blue]
    > If I simply run the program from the shell, it writes the file no
    > problem.[/color]

    Then it is you (alex) that is executing the scirpt.
    [color=blue]
    > If i run the program through an exec call in a php script,
    > however, the program executes but it seems to not have the correct
    > permissions to be able to write the file.[/color]

    Now it is the webserver executing the script. (usually nobody or
    www-data).



    --
    Met vriendelijke groeten,
    Tim Van Wassenhove <http://www.timvw.info>

    Comment

    • chmod000@gmail.com

      #3
      Re: php exec to C program that writes file

      Yes, in my case it is 'nobody'. What stumps me is that I have the
      ability to do an fopen/fwrite through php to create a file but I can't
      through the C executable. What do I need to do to fix this?

      Comment

      • chmod000@gmail.com

        #4
        Re: php exec to C program that writes file

        d'oh. fixed. thanks!

        Comment

        Working...