I use drupal a few months there was no problem, but after 1 month I did not update my website to find errors on the website, at:

warning: realpath () [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 516 is not allowed to access / tmp owned by uid 0 in / home / jeparasp / public_html / includes / file.inc on line 190.

warning: realpath () [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 516 is not allowed to access / tmp owned by uid 0 in / home / jeparasp / public_html / includes / file.inc on line 763.

how can I fix it?
Please help. thanks.

Comments

mareks’s picture

Maybe the host (server) changed some settings? Tho' this may not help you to solve the problem...

cburschka’s picture

Drupal does not support safe mode (see system requirements). If you were able to install it at first, it's possible your host later downgraded PHP by enabling safe mode, and thus broke your site. Or it's possible that the Drupal installer doesn't check for safe mode, and you only recently switched to private downloads or started uploading files, or something.

In either case, you should complain to the host and explain what a horrible kludge safe mode is.

hubbi.fillah’s picture

I have asked the host to turn off safe mode, but still not lost my problem. What should I do?

goye2cz’s picture

I've just migrated a site to a new server. Works fine at the old server, fine on my test server, but I can't even log in at the new server because I'm getting the safe mode error. In contrast, I have completed a simple drupal install in a test folder of the site and it's working with clean urls, the path module, I just haven't imported the old database. As soon as I do that, I get the errors. Will be interesting it the host's tech support has a response.

Redherring’s picture

I had been developing a new Drupal site on a host I had not used before. All was OK for a couple of weeks when suddenly this error message apppers:

"warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 1919 is not allowed to access /tmp owned by uid 0 in /home/ginkgoes/public_html/spes/includes/file.inc on line 190."

I have no trouble logging in, creating pages or congiguring the site. I just get this annoying message.

If I clear the browser cache and re-display the site, there is no error message. It only appears on the second and subsequent times I display a page. It appears on all pages and in both Firefox and IE.

Having read the discussion here I got in touch with my host support and they fixed the problem quickly by switching off SAFE MODE. The problem is: why did the problem not appear immediately I set up my Drupal site and does this config in any way compromise the security of my site?

Thoughts appreciated. I'd be interested in the outcome of goye2cz's dealings with his/her support.

Michael Oskouian’s picture

Hello Rob,

In your php.ini file, there is a command line called Safe mode:On... you can switch it to off and re-save and you should be good to go.

Thanks,
Michael Oskouian (Seattle)

Redherring’s picture

Thanks for that suggestion, Michael. But whereabout in the drupal file system do i find it?

Thanks.

Rob

bikramth19’s picture

The reply was awesome, it work for me..

Thanks a lots

zygmurti’s picture

I have turned the safe mode off but I still get the error. It sometimes disappears for a while only to be back after I refresh the site or navigate somewhere else. I looked for ages on how to resolve this without any results can someone please help us.

Oh and I assume that most of the hosts won't allow access to php.ini and if so changing this is without their involvement is out of the question.
Yet some people still get the error even if they have disabled safe mode.

Thanks

hakanyanaz’s picture

You must remove the slash before tmp

thekurt’s picture

I also removed the slash before tmp in filesystem (www.yoursitename.xxx/admin/settings/file-system) and the error-message disappeared.

Kurt

ressa’s picture

Thanks, I got it after my host upgraded to php 5.3.6 and perhaps changed some setting also? Removing the slash before tmp fixed it.

tmsimont’s picture

thanks! this fixed it for me, too... stupid slash!

exius’s picture

i was getting something like:

warning: realpath() [function.realpath] SAFE MODE Restriction in effect. The script whose uid is 516 is not allowed to access /public/sites/default/files owned by uid 0 in /public/includes/file.inc on line 763.

i solved it in SSH term:

(while in /.../public/ folder)
rmdir -R sites/default/files
mkdir sites/default/files
chmod 644 sites/default/files

or if you are lucky, you can do the same with your FTP client:

remove sites/default/files
create folder sites/default/files
set permission 644 (if necessary)

the error message goes away nice and easy!

exius

crisis2’s picture

warning: realpath() [function.realpath]: SAFE MODE Restriction in effect. The script whose uid is 603 is not allowed to access /tmp owned by uid 0 in

how to fix?

ahmedsalem’s picture

if u have whm cpanel
Main >> Service Configuration >> PHP Configuration Editor
and make safe_mode off

Anonymous’s picture

I had the same error, removing the slash worked. Thanks to those who suggested it!

Juc1’s picture

sub

pshall195’s picture

I too have experienced this after relocating a drupal site.

Thanks to others who have commented here for giving me a clue to solving it.

For some reason the 'Temporary directory' setting on the file system configuration page ('/admin/settings/file-system'), was set to '/tmp'

This is wrong and will not work in a shared hosting environment where, typically, Drupal will not have write access to such a path, be it site relative or otherwise.

The error message is somewhat misleading because it has nothing to do with PHP safe mode. That occurs presumably because it is a permissions error and the response is a generic one.

I cured my problem by setting it to 'sites/default/files/tmp' and creating the 'tmp' directory with write access. I also had the 'Download method' set to public.

Hope that is helpful.

mudsurfer’s picture

Thanks to all posters.
I just has this same warning: realpath () [function.realpath]: SAFE MODE warning, which was preventing scheduled backups through Backup and Migrate module. I am not sure what triggered this to occur, as I had not modified this site for a month, and I have many other sites on the same account with a shared host - and no other sites seem to have any issues at the moment.

But the reedy was indeed as discussed above:
/admin/settings/file-system and remove the "/" from the temporary directory path (was "/tmp", save to "tmp")
error dissappeared and my backups resumed.

stevensunsunsun’s picture

Thank you all so much for discovering the solution!

In my case, JustHost enabled safe_mod without notification me first effecting 5 sites:

"we have recently enabled safe_mod on all our servers to improve security level on the servers"

cyrion’s picture

@pshall195: You provided me with the solution to my problem. Great! Thanks.