Executing a php script from C, using fork and execv

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crazydanwic
    New Member
    • Dec 2006
    • 1

    Executing a php script from C, using fork and execv

    //runScript.c
    pid= fork();
    if(pid ==0) {
    error = execv("/usr/local/bin/php", "something.php" , (char *)NULL);

    exit(0);
    } else {
    wait(pid);
    exit(0);
    }

    the php file has #!/usr/local/bin/php at the top

    However, the file is not run, I am thinking I need to reset the file descriptors.
    -something.php runs in an infinite loop and should write to the stdout.
Working...