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 ?


Scripting LanguagesPHPShell Scripting

Avatar of undefined
Last Comment
thierry91
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

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of thierry91
thierry91

ASKER

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
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo