1

I know, it may sound ridiculous, but I can't turn off safe_mode. I'm using wkhtmltopdf (which is best html->pdf converter I've used, and yes, I tried html2ps, fpdf and lots of others). And it needs to be executed with exec() function. I've done

  • find / | grep php.ini,

found all of php.ini's and changed safe_mode to Off. Then added

  • php_flag safe_mode Off

to .htaccess and

  • php_admin_flag safe_mode Off

to httpd.conf. And still I'm getting the following errors:

  • Warning (2): shell_exec() [function.shell-exec]: Cannot execute using backquotes in Safe Mode [APP/vendors/wkhtml/wkpdf.php, line 79]

Update: Ok, I've found an answer. Since I had virtualhosts, each virtualhost had it's own httpd.conf inside of it's own directory, and it had "safe_mode off" inside of it.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
Mee
  • 458
  • 1
  • 6
  • 21
  • 1
    Silly question: does `phpinfo()` inform you about more `.ini` files loaded? – Wrikken Aug 06 '10 at 00:19
  • well... as you can see, the problem was in https.confs, and not inside of .ini files. but thanks or advise. – Mee Aug 06 '10 at 00:39

3 Answers3

2

Ok, I've found an answer. Since I had virtualhosts, each virtualhost had it's own httpd.conf inside of it's own directory, and it had "safe_mode off" inside of it.

Sorry for disturbance.

Mee
  • 458
  • 1
  • 6
  • 21
1

You have probably forgot to restart your httpd.

Also, this question belongs on ServerFault.

André Laszlo
  • 15,169
  • 3
  • 63
  • 81
1

maybe use ini_set() to disable safemode right before shell_exec() ? but propably ini_set is disabled in safemode as well...

Andreas Linden
  • 12,489
  • 7
  • 51
  • 67