wmguk Posted August 21, 2008 Share Posted August 21, 2008 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:drew@wicked-websites.co.uk'>Wicked Websites</a></p>"; } any thoughts as to why this wont work? Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 21, 2008 Share Posted August 21, 2008 Shouldn't the user/group be a string? <?php chown($thisdir . '/' . $login, 'ftpiwphoto'); chgrp($thisdir . '/' . $login, 'psacln'); ?> Give it a try. Quote Link to comment Share on other sites More sharing options...
wmguk Posted August 21, 2008 Author Share Posted August 21, 2008 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 Quote Link to comment Share on other sites More sharing options...
Fadion Posted August 21, 2008 Share Posted August 21, 2008 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. Quote Link to comment Share on other sites More sharing options...
wmguk Posted August 21, 2008 Author Share Posted August 21, 2008 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.... Quote Link to comment Share on other sites More sharing options...
wmguk Posted November 6, 2008 Author Share Posted November 6, 2008 is there any more info on this? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted November 6, 2008 Share Posted November 6, 2008 This is more of a UNIX admin problem than PHP. You can try putting the user "ftpiwphoto" into the same group as the Apache user. Ken Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.