PDA

View Full Version : File permissions on files created by php?


Klowner
03-31-2004, 01:39 PM
I did a couple searches in the forums but I didn't see anything that pertained to this specific problem, so here it is..

I've got a PHP script that creates files on the server, these files are owned by 'nobody', and have the permissions of -rw-r--r--

My problem is, I can't remove these files or directories if I go in with an FTP client, and the web based File Manager doesn't have a function for changing ownership (or so it appears).

Anyone have any interesting suggestions?

Thanks much,

Mark
Klowner

TomD
03-31-2004, 06:35 PM
Try deleting the files and directories with a PHP script.

PHP Filesystem Reference (http://www.php.net/manual/en/ref.filesystem.php)

y6y6y6
03-31-2004, 08:11 PM
You can also delete the files from the control panel's file manager.

Cope
03-31-2004, 08:33 PM
Originally posted by y6y6y6
You can also delete the files from the control panel's file manager.
Exactly, and if they still refuse to be removed, possibly that file is already in /.trash/ ..... just rename the file then delete it.

JCornett
05-02-2004, 12:37 AM
On a shared host I have had the most success using ftp through the php script to handle all file functions. If PHP is in safe mode (almost always on shared hosts), you create the file this way and then immediately do a SITE command to CHMOD the file like the following:


$this->connect_ftp();
if(ftp_mkdir($this->conn_id, $path)) {
// This next command works if your FTP server supports SITE commands
// PHP5 supports direct CHMOD through FTP
ftp_site($this->conn_id, "CHMOD 0777 \"".$path."\"");
} else {
$GLOBALS['error'][]='Error creating directory';
}