Hello open php.ini for your server(use pico) find safe_mode and assign the values you require, in your case safe_mode = Off you can find path of php.ini by running phpinfo file.
depends where your php.ini file is. login to ssh enter locate php.ini at least one file should display. now type vi location of php.ini file then just find the safe mode setting. you will then need to restart apache or your server for the changes to take effect.
Upload a phpinfo file to the server. Open it in browser, find the location of php.ini as stated in the phpinfo file. Login to ssh and su to root and edit the file using nano or pico find safe_mode=XX Change its valur to on or off as stated after "="