1

Is there anyway to turn off PHP`s safe mode at runtime? Its disabled by default but everytime a cronjob or I start a script over ssh it's activated.

I don't know what to change in the php.ini, because all safe_mode entries are already set to disabled :-/

The server is running on Suse 11.3, Plesk and php 5.3.

Jk1
  • 11,233
  • 9
  • 54
  • 64
mercsen
  • 692
  • 1
  • 5
  • 21
  • The easiest way to do it is to upgrade to `5.4`... And probably, you're editing the wrong php.ini file. You need the correct one, and it's the only place you're allowed to do it (as it's a `PHP_INI_SYSTEM` setting), so, examine the output of `php --ini` from your command line. – Wrikken Oct 17 '13 at 17:40
  • thanks, but it is the right ini file, i changed a lot in it and everything works quite well. i start to think that its a plesk issue.... even if im running the scrit using the `php /foo/bar/script.php`command ..... – mercsen Oct 17 '13 at 17:41
  • or uses php over ssh another file? – mercsen Oct 17 '13 at 17:42
  • Have you _explicitly disabled it_, or did you remove the setting? Also, look at for those additional files scanned... (and of course, test the method of calling php you'll use, add the `--ini` there) – Wrikken Oct 17 '13 at 17:42
  • yes and yes ;) it IS disabled. But somehow, as soon as i start the script inside of a cronjob or with the php command i get this output: `PHP Warning: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0` my issue is that i want to include some files inside the htdocs directory, because my cron file is located somewhere in /home – mercsen Oct 17 '13 at 17:44
  • And what if you run `php --php-ini /path/to/the/php.ini/you/edited /path/to/script/you/run.php`? – Wrikken Oct 17 '13 at 17:47
  • good idea, same result :( – mercsen Oct 17 '13 at 17:48
  • Ugh, probably a borked php comes with plesk. What does `which php` give you, and is that a binary or a script? – Wrikken Oct 17 '13 at 17:49
  • the output is `/usr/bin/php`which is a link pointing to `/etc/alternatives/php` which is a link itself pointig to `/usr/bin/php5` which is finaly a binary – mercsen Oct 17 '13 at 17:52
  • OK, and you are sure safe_mode is on, and you have problems accessing files because of it, not just a warning that you shouldn't use the setting anymore? So, `php -i | grep safe_mode` clearly states it's on? 'cause in that case, it would almost have to mean is baked in statically while compiling that binary... – Wrikken Oct 17 '13 at 17:56

0 Answers0