Question: i have a problem with php ! i want to run an external program with php . this program work in command line and in linux platform . so it must be work just fine . but i try more time and i can't run it . so what's wrong !
this is the link of the program : <http://www.lalescu.ro/liviu/fet/>
and this is the command which work fine in command line and not the case in php :

```
./fet --inputfile=Hopwood.fet --outputdir=out

```

and this is the php code :

```
<?php
`./fet --inputfile=Hopwood.fet --outputdir=out`
?>

```

i hope to solve this pb .
thanks in advance ..

**Update** i upload the executable program and the Hopwood.fet file for you try it ..
this is a link :
<http://rapidshare.com/files/454756427/fet.tar.gz>

Answer: 
try doing it in full path:

```
/path/to/installed/fet --inputfile=/path/to/your/Hopwood.fet --outputdir=/path/to/your/out

```

so you'll end up executing:

```
exec("/path/to/installed/fet --inputfile=/path/to/your/Hopwood.fet --outputdir=/path/to/your/out");

```

Also, make sure running process has ability to write to your `/path/to/your/out`

**UPDATE**

To make thing's clearer, please try to run this command:

```
exec("/path/to/installed/fet --inputfile=/path/to/your/Hopwood.fet --outputdir=/path/to/your/out 2> /tmp/fet.error.log", $output, $status);

echo "status: " . $status;
echo "output: " . implode("\n", $output);

if(file_exists("/tmp/fet.error.log"))
{
  echo "Error Log: " . file_get_contents("/tmp/fet.error.log");
}

```

**UPDATE**

as @mkotwd told on another answer (after trying debug code, above). The problem is because `fet` trying to access X Server. So, as @mkotwd answer's the solution is add:

```
export DISPLAY=:0

```

and the command become:

```
exec("export DISPLAY=:0 && fet --inputfile=Hopwood.fet --outputdir=out");

```
Check `php -i | less` for:

* [safe\_mode](http://php.net/manual/de/features.safe-mode.php)
* [configuration of suhosin](http://www.hardened-php.net/suhosin/configuration.html), if installed

It might be one of those security measures, which prevents those critical commands (or both).