I think maybe this is not a problem with Apache and PHP. The documentation of exec indicates that "With safe mode enabled, the command string is escaped with escapeshellcmd(). Thus, echo y | echo x becomes echo y \| echo x.". So maybe it is a bug of Ezpublish that sends a commande line with a ">" inside which is escaped with a "\".