With the assumption that you do not want to turn safe mode off, you might look at safe_mode_exec_dir in php.ini.
If your php.ini is missing all the nice comments describing configuration parameters, here's what mine reads:
; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir =