php - Shell_exec nohup with nohup.out -


executing code:

shell_exec('nohup command&'); 

or this

shell_exec('nohup command > /path/to/nohup.out 2>&1&'); 

but there no nohup.out in both cases. how can run nohup nohup.out via php?

shell_exec('nohup command > /path/to/nohup.out 2>&1&');

this line work. make sure have write permissions output folder. consider output folder /usr/nohup-out

ls -l /usr/nohup-out 

it should have write, read , execute permissions (rwx). if not, this:

sudo chmod -r 777 /usr/nohup-out 

now, try execute php file. should create nohup file in /usr/nohup-out folder.

sample script , result:

1. date.php:

<?php shell_exec('nohup date > /usr/nohup-out/nohup.out 2>&1&'); ?> 

2. execute php terminal:

php date.php 

3. nohup.out content after execution

thu apr 23 11:30:28 ist 2015


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -