Link to home
Start Free TrialLog in
Avatar of thierry91
thierry91

asked on

how to solve "backquotes" problem for shell_exec():

hello
I use script php shell for make some action and in this php file I use function shell_exec():
but this create error :
Warning: shell_exec(): Cannot execute using backquotes in Safe Mode in /root/mail_check.php on line 68

but see this part of my conf php :
safe_mode = Off
safe_mode_gid = Off
; safe_mode_include_dir = /data/www/generated
; safe_mode_exec_dir = /data/www/bin
; safe_mode_allowed_env_vars = PHP_
; safe_mode_protected_env_vars = LD_LIBRARY_PATH

safe mode is Off

and line woth probleme in php script is :
        $commande="/root/qmHandle -D";                 //line 67
        $result=shell_exec($commande);                 //line 68
        echo $result;                                                  //line 69

have you solution ?


Avatar of Maciej S
Maciej S
Flag of Poland image

Is the safe_mode really off? Check it in phpinfo(). Look at Local value column. Maybe safe_mode is off by default n your configuration, but it's turned on in vhost definition or some .htaccess file?
Avatar of thierry91
thierry91

ASKER

for exec my script I use special php.ini
and my script php is start with this commande :
php -c /root/phpini/ /root/mail_check.php

and if you see in my question I give part of php.ini I use :
safe_mode = Off
safe_mode_gid = Off
; safe_mode_include_dir = /data/www/generated
; safe_mode_exec_dir = /data/www/bin
; safe_mode_allowed_env_vars = PHP_
; safe_mode_protected_env_vars = LD_LIBRARY_PATH

but for you can see I have attach php.ini used.
thx
php.ini.txt
ASKER CERTIFIED SOLUTION
Avatar of Maciej S
Maciej S
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thx, the probleme is simple :
php -c /root/phpini/ /root/mail_check.php                          // -> BAD
php -c /root/phpini/.php.ini /root/mail_check.php               // -> GOOD

thx