Hello. I have compiled a c++ program and i want it to be run into a webpage. I have tried the proc_open() command but it doesnt work. any help or suggestion?

$descriptorspec = array(
   0 => array("pipe", "r"),  
   1 => array("file", "xpdf","r")

$cwd = '/tmp';
$env = array('some_option' => 'aeiou');

$process = proc_open('php', $descriptorspec, $pipes, $cwd, $env);

if (is_resource($process)) {

    fwrite($pipes[0], '<?php print_r($_ENV); ?>');

    echo stream_get_contents($pipes[1]);

    $return_value = proc_close($process);

    echo "command returned $return_value\n";

this is the code that i have written but it doesnt work. xpdf is the file that i want to run into the webpage.

This isn't C++, it is php. since you are already in the php environment, why do you use the '<php print... ?>' construct in the fwrite function on line 14?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.