views:

34

answers:

2

Hi,

I tried to start a background process with php, for that, I added a & at bottom on exec function but after a few days it stop working.

Basically

If i have file 1.php with:

<?php var_dump(exec('/home/2.php > /home/2.output 2>&1 &'));

And file 2.php with:

<?php sleep(5); echo "Fill\n";

Running file 1.php, it return an empty string not -1 or something else, but using console and calling 1.php it work ok:

php-cgi -eq -f /home/1.php

I'm using ubuntu 9.04 with 2.6.18-164.10.1.el5.028stab067.4

I'm a bit lost, What could i do?

A: 

Check /var/log/kern.log for "audit" level error messages. It's possible that the exec is being prohibited for some reason.

It's also quite possible that the write to /home is being prohibited. Try writing to /tmp instead?

Charles
Thanks Charles, the truth is that I'm a bit lost at the situation. The kernel log is empty and the server error too. Using the temporary directory has not been any change, the only way to work from the server is not launch a child process.<?php exec('/home/2.php > /home/2.output 2>I don't know where I can check to debug.
+1  A: 

Well, after a nightmare trying to solve the issue, finally i update ubuntu from 9 to 10, this solve the problem, i think some update of linux break php, if it happend me again, probably i'll begin rebooting the vps.