在安全模式下运行shell命令 - php

I want to execute shell commands on my server. I'm using shell_exec() for that purpose. Problem is with safe mode turned on it gives error:

PHP Warning:  shell_exec(): Cannot execute using backquotes in Safe Mode

Also i do not want to turn off safe mode. Is there anyway to execute this with safe mode or any other command for same purpose?

Safe Mode disables shell_exec():

shell_exec() (functional equivalent of backticks) This function is disabled when PHP is running in safe mode.

The whole point of Safe Mode is to prevent shell-level execution from within a PHP script. So, no, there's no way around it, unless you write your own PHP extension.

Also, be aware that Safe Mode is DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.

Your requirement is to dump mysql and there is no MySQLi library for that. So what you can do is, create a PHP extension that does mysqldump (you can use the system function in C), install the extension and call it from PHP as a function.

An example of how to create a PHP extension is here: http://devzone.zend.com/303/extension-writing-part-i-introduction-to-php-and-zend/