$DOCUMENT_ROOT open_basedir errors

I have been pretty much beating my head against the wall for the better part of the afternoon trying to track down a problem I was having with the php function move_uploaded_file and GD image resizing. I kept getting errors that the open_basedir restrictions were in effect when I referenced a file as $DOCUMENT_ROOT.

I discovered the solution. Wrapping $DOCUMENT_ROOT as realpath($DOCUMENT_ROOT) made the problems go away. This solution was referenced in another post but I am posting it here with keywords to help people searching. :slight_smile:

I think the problem would go away if I were using php as a CGI but I can’t figure out how to make my extensionless files processed as CGI-php. All my scripts need to be processed as the same user because I am using sessions on every page. Sessions created as Apache can’t be read by the CGI.

I hope this helps someone!