Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell_exec not returning all text

Status
Not open for further replies.

Hemo

Programmer
Apr 9, 2003
190
US
It seems that within PHP my shell_exec command is only returning 12 characters max.

The command run from the command line:
Code:
ps -ef|grep server-bin|head -1|awk '{print $10}'

This returns the full string of 18 characters, in this case.

When run like this from a php script:

Code:
$mapname = shell_exec("ps -ef|grep server-bin|head -1|awk '{print $10}'");
print $mapname;

I only get the first 12 characters of the output. Of course, if my output is 12 characters or less, this is no problem, but sometimes it is longer than 12.

Anyone know what gives here?

 
Interesting addition:

Viewing source of web page created by my script shows the text cut off after 12 characters.

Running my script from the command line and outputting the stream to STDOUT shows the full string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top