Probably your apache server runs as "system" as a non-interactive service. Many things won't work and probably also pipes for console applications. Also, you could have permission problems because your console (where it works) has user (yours) permissions, while spawned console has system permissions.
If you really need pipes, you could try to run apache as a user (and not system) and configure the service enabling desktop interaction.