Forum Moderators: coopster

Message Too Old, No Replies

safe mode

         

jackvull

10:07 pm on Dec 28, 2005 (gmt 0)

10+ Year Member



I have a script, which backs up my MySql database on a regular basis. Unfortunately, this only runs when safe mode is off.

Is it possible to turn safe mode off for a brief time period to run this script, either with ini_set or with a .htaccess file?

jatar_k

10:30 pm on Dec 28, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



if you look at
[php.net...]

safe_mode is only changeable by PHP_INI_SYSTEM

which means "Entry can be set in php.ini or httpd.conf"

this excludes .htaccess

jackvull

10:08 am on Dec 29, 2005 (gmt 0)

10+ Year Member



Thanks for the reply.
The only bit I don't understand is that on this page:
[nl3.php.net...]
&
[nl3.php.net...]
they mention how to set safe_mode from within scripts but it seems it cannot be done so unsure as to why?

As I would prefer to have safe mode ON but need to still run my database backups, is there an alternative I could use to allow the DB backups (through use of system(mysqldump etc,) to work?

Thanks.

jatar_k

4:53 pm on Dec 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



are you running crons to do it?

cron could be run as a different user.

You could also talk to your host and ask what they suggest since they are enforcing the restriction.

jackvull

5:07 pm on Dec 29, 2005 (gmt 0)

10+ Year Member



Yeah a cron runs it but they won't change the user.
They're not enforcing safe mode. They'll quite happily let you turn it off but there's no way to allow temporarily turning it off with a script.

The ini_set and .htaccess have ways of doing it but I guess there must be another setting to do this?

jatar_k

5:13 pm on Dec 29, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



>> ini_set and .htaccess have ways of doing it

actually from what the manual says they don't as it is 'PHP_INI_SYSTEM' which is only at the server level.