Use a php function rather tan using exec. Suggested-by: garga