In server security many time shared service provider enable the safe_mode which is causing the problem to run the script which required the safe_mode disabled.
Use the following code in the respective domain VirtualHost entry in the server main Apache configuration file (/etc/httpd/conf/httpd.conf) file of domain under which require safe_mode Off.
php_admin_value safe_mode Off
If server is SuExec enabled server then use the php.ini to turn off safe mode, if you are not sure server is SuExec enabled or not then refer to following URL to confirm server is SuExec or not.
safe_mode = Off