Jump to content

chmod, chgrp and chown doesnt work from php


wmguk

Recommended Posts

Hi Guys,

 

I'm running a script however I get this error:

Notice: Use of undefined constant ftpiwphoto - assumed 'ftpiwphoto' in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 15

Warning: chown() [function.chown]: Operation not permitted in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 15

Notice: Use of undefined constant psacln - assumed 'psacln' in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 16

Warning: chgrp() [function.chgrp]: Operation not permitted in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 16

 

this is the script

if (is_dir($thisdir ."/$login") )
{
}
else
{
if(mkdir($thisdir ."/$login" , 0777, true)){
if ($user = 'kmaunton'){
chown($thisdir ."/$login" , ftpiwphoto);
chgrp($thisdir ."/$login" , psacln);
} else { }
}

else
{
   echo "<p class='footer'>Failed to create directory... <br> Contact <a href='mailto:[email protected]'>Wicked Websites</a></p>";
} 

 

any thoughts as to why this wont work?

Ok, I've tidied the code up slightly but I still get this error:

 

Warning: chown() [function.chown]: Operation not permitted in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 16

Warning: chgrp() [function.chgrp]: Operation not permitted in /var/www/vhosts/iwphoto.co.uk/httpsdocs/photographer/createadmin/create.php on line 17

I should let the experts talk on this, but chown() can only be used by the superuser. Stated in the manual:

 

Only the superuser may change the owner of a file. 

 

The Apache user, shouldn't be a superuser so I guess that's why you are getting errors.

ahh, ok, :( the problem is there are 3 different people using this script, 2 people use windows explorer for ftp access, and one uses ftp software.

 

when the user is apache the 2 people using windows explorer can connect and upload etc.... however the other chap cant, and if i set the user as ftpiwphoto then he can use the software but they cant use explorer...

 

the idea was, if he creates the account then its chmoded to ftpiwphoto, however if its the other two then its just apache...

 

I'll have to try something else, I looked at a drag and drop php ftp program but just couldnt get it to work, and this seemed to work well to start with, but now I have this problem.

 

the issue is it needs to be a drag and drop system as there could be 800 images per upload so just having a browse style button wont be practical....

 

 

  • 2 months later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.