apache suexec, CGI PHP and filesystem stuff

From: Date: Sun, 23 May 2004 17:46:31 +0000
Subject: apache suexec, CGI PHP and filesystem stuff
Groups: php.general 
Request: Send a blank email to php-general+get-186802@lists.php.net to get a copy of this message
I posted a few days ago about problems with filesystem commands like copy(), move_uploaded_file(), backticked shell commands and so on while using CGI PHP under apache suexec. It seems that these only work in directory trees starting in the directory in which the script itself resides. So if the script is in, say, /usr/home/user/website/cgi-bin then none of these will work except on (executable) files and directories in this directory or its sub-directories. So an attempt to move_uploaded_file() to /usr/home/user/website/pages/images/ will fail but will succeed if aimed at /usr/home/user/website/cgi-bin/images Symbolic links provide a workaround in cases like the one I've been looking at, where I want to provide a form in a website control panel to upload images for display in the site. I'm posting this so it's available to others, because I haven't found any mention of this (or any other) solution when googling. PWR.

« previous php.general (#186802) next »