質問

I'm running a cron which is run under another user (not apache) and when I try to access apache's files it shows an error like:

fopen(): SAFE MODE Restriction in effect. 
The script whose uid is 10017 is not allowed to access ....

It's because safe_mode is turned on and it doesn't let me use apache's files (in this case uploaded files through the site). How can I overcome this? In php.net it says I have to be superuser to be able to change ownership which doesn't seem very secure to me ...

役に立ちましたか?

解決

You run the PHP script through the 'php' interpreter (from a cron job) rather than through Apache's mod_php. This means you can enable and disable PHP's safe mode as you please.

You should probably do something like php -d safe_mode=0 myscript.php.

他のヒント

Or call your cron via an http request.

wget -O - -q -t 1 http://yourdomain/myscript.php

Because it's done via the interwebs, Apache will be the user.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top