chmod() error messages

chmod() error messages

by Norbert Berger -
Number of replies: 15
I still get the following error message on a hosted installation when I upload pics

Warning: move_uploaded_file(): Moved: '/var/tmp/phpTFUeUV' to '/home/englishs/vle/users/2/ngberger.jpg' in /home/englishs/public_html/vle/lib/uploadlib.php on line 225

Warning: chmod(): Operation not permitted in /home/englishs/public_html/vle/lib/uploadlib.php on line 226

What is this chmod() thing? And how do I get rid of it?

Please help me, anyone!

Norbert
Average of ratings: -
In reply to Norbert Berger

Re: chmod() error messages

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
lib/uploadlib.php
-----------------
225: if (move_uploaded_file($this->files[$i]['tmp_name'], $destination.'/'.$this->files[$i]['name'])) {
226: chmod($destination .'/'. $this->files[$i]['name'], $CFG->directorypermissions);

> What is this chmod() thing? And how do I get rid of it?

Please don't! chmod() is your friend. smile

It simply says you (your webserver I mean) doesn't have the permissions on the target. This $destination thing comes under the so called moodledata directory, where the webserver _must_ have write permissions.

In reply to Visvanath Ratnaweera

Re: chmod() error messages

by Norbert Berger -
Dear Visvanath

Thanks for your reply. I have given moodledata permission 777 which to my understanding means the server has full rights.
So what do I need to change where to avoid the error message?

Sorry I am so thick and inexperienced with Linux. I have found that chmod sets permissions, but VDeck on the hosting interface uses numbers to change permissions. PhPMyadmin is available, but I dare not really venture there without clear guidelines. have managed to repair a table once but that's as far as my experience is concerned.

Norbert
In reply to Visvanath Ratnaweera

Re: chmod() error messages

by Norbert Berger -
To be precise here is a more complete list of the errors I have been getting:

Error messages on Moodle

 

Warning: move_uploaded_file(): Moved: '/var/tmp/phpTFUeUV' to '/home/englishs/moodledata/users/218/ngberger.jpg' in /home/englishs/public_html/moodle/lib/uploadlib.php on line 218

Warning: chmod(): Operation not permitted in /home/englishs/public_html/moodle/lib/uploadlib.php on line 219

 

 


Warning: move_uploaded_file(): Moved: '/var/tmp/phpTFUeUV' to '/home/englishs/vle/users/2/ngberger.jpg' in /home/englishs/public_html/vle/lib/uploadlib.php on line 225

Warning: chmod(): Operation not permitted in /home/englishs/public_html/vle/lib/uploadlib.php on line 226

 

When restoring backup:

 

Warning: chmod(): Operation not permitted in /home/englishs/public_html/vle/backup/lib.php on line 275

 

Warning: chmod(): Operation not permitted in /home/englishs/public_html/vle/backup/lib.php on line 275

Warning: chmod(): Operation not permitted in /home/englishs/public_html/vle/backup/lib.php on line 275

 

When trying to delete a file:

 

Warning: unlink(/home/englishs/vle/1/backup/backup-bus._writing-20060404-0845.zip): Permission denied in /home/englishs/public_html/vle/lib/filelib.php on line 355

Error: Could not delete: /home/englishs/vle/1/backup/backup-bus._writing-20060404-0845.zip

Any suggestions what files or directories need permissions changed? And to what?

Many thanks

Norbert
In reply to Norbert Berger

Re: chmod() error messages

by Thomas Greene -

CHMOD is a utility to set permissions on a file or folder i.e. read, write, execute, etc. This utility is used on Apache web servers. I had EXACTLY the same error messages you did in uploading a file and crating a folder. I asked the site administrator at my ISP to change the permissions for me. He changed them to 755 and I was able to upload and create folders after that. However, other operations such as updating generate the message and I have asked them if they can changes permissions on another set of folders. I will let you know what happens.

Tom
New moodler

In reply to Thomas Greene

Re: chmod() error messages

by Norbert Berger -
Great thanks. I do have access to VDeck a control panel to set permissions on directories and files, but each single file or directory would need changing individually. Besides, I don't really know what I might be doing asnd what vulnerabilities I might cause, so I am happy to receive clear guidelines.

Thanks again

Norbert
In reply to Thomas Greene

Re: chmod() error messages

by Norbert Berger -
Hi Thomas

Still no joy: directory permissions set to 777, uploadlib.php 744, still I get error messages on ipower web server:

Warning: move_uploaded_file(): Moved: '/var/tmp/phpf8eKN8' to '/home/englishs/public_html/moodledata/users/5/DSC00069.JPG' in /home/englishs/public_html/moodle/lib/uploadlib.php on line 225

Warning: chmod(): Operation not permitted in /home/englishs/public_html/moodle/lib/uploadlib.php on line 226

And all the other errors I had.
Ipower's chat suppoort says 'sorry, my job is level 1 support, and I am not supposed to give that level of support you might need.' Email support is uniform: 'We are sorry at your inconvenience, Please send us more details and read our help page' (which has nothing relevant). Then after sending details - stumm. Really irritating.
black eye

Any ideas anyone? What should I ask their support team to do that will kick them into shape and set the server so I do npot get these error messages?

In reply to Norbert Berger

Re: chmod() error messages

by Thomas Greene -

Hello Norbert,

I can now upload photos. It is matter of waiting.

1 I went to the User Profile and uploaded a photo for the user and ignored the error message for a dozen or so photos.

2 I went to my FTP site and changed the file permissions on the NEWLY created files to 755.

3 I went back to the user profiles and tried the up load again

I can change and upload photos.

Cheers

Tom

In reply to Thomas Greene

Re: chmod() error messages

by Norbert Berger -
Hi Tom

Seems we are in similar situations. Tried your website, and as you say, it won't allow the picture upload.

On http://englishstudydirect.com/vle I have set up a moodle database which allows you to upload your file but it still shows the error messages listed above. I have contacted ipowerweb support, now with a question about ownership: it seems that if I change permissions as the site administrator that may not actually mean that the server software apache and mysql actually have the same rights. Is that correct?

Still confused.Support by the hosting provider has not been fantastic. May have to recommend to the company, whose site I am trying to set up, that they change hosting provider.

Best wishes and thanks

Norbert
In reply to Norbert Berger

Re: chmod() error messages

by Iñaki Arenaza -
Picture of Core developers Picture of Documentation writers Picture of Peer reviewers Picture of Plugin developers
On http://englishstudydirect.com/vle I have set up a moodle database which allows you to upload your file but it still shows the error messages listed above.

Hummm, I suspect you have something wrong in your config.php file, as the themes are not getting applied. It seems you have your wwwroot pointing to the wrong URL.

On the other hand, regarding the permissions problem, upload some file and then, by ftp, have a look at the permissions of it and who the owner and the group of the file are (you can do this by issuing a 'dir' command).

Now do the same for the moodledata directory itself and posts the results here, please.

Saludos. Iñaki.

In reply to Iñaki Arenaza

Re: chmod() error messages

by Norbert Berger -
Hi Iñaki, Thomas and everyone else who is helping out here

Here's a copy of the relevant information in the config file:

$CFG->dbtype    = 'mysql';       // mysql or postgres7 (for now)
$CFG->dbhost    = 'localhost';   // eg localhost or db.isp.com
$CFG->dbname    = 'englishs_vle';      // database name, eg moodle
$CFG->dbuser    = 'englishs';    // your database username
$CFG->dbpass    = '****************';    // your database password
$CFG->prefix    = 'mdl_';        // Prefix to use for all table names

and the directories are:
$CFG->wwwroot   = 'http://englishstudydirect.com/vle';
$CFG->dirroot   = '/home/englishs/public_html/vle';
$CFG->dataroot  = '/home/englishs/vle';
$CFG->directorypermissions = 02777;


And directory information through ftp is as follows:
for directory lib
drwxr-xr-x    4 3671     englishs     1024 Apr  3 12:04 .
drwxrwxrwx   25 3671     englishs     1024 Apr  9 01:03 ..
-rw-r--r--    1 3671     englishs      955 Apr  3 12:04 README.txt
-rw-r--r--    1 3671     englishs    17233 Apr  3 12:04 STATUS.txt
-rw-r--r--    1 3671     englishs     4463 Apr  3 12:04 backup.php
-rw-r--r--    1 3671     englishs    10245 Apr  3 12:04 backup_check.html
-rw-r--r--    1 3671     englishs    14305 Apr  3 12:04 backup_execute.html
-rw-r--r--    1 3671     englishs    10394 Apr  3 12:04 backup_form.html
-rw-r--r--    1 3671     englishs    31271 Apr  3 12:04 backup_scheduled.php
-rw-r--r--    1 3671     englishs    76497 Apr  3 12:04 backuplib.php
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:04 bb
-rw-r--r--    1 3671     englishs     8547 Apr  3 12:04 config.html
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:04 db
-rw-r--r--    1 3671     englishs    18443 Apr  3 12:04 lib.php
-rw-r--r--    1 3671     englishs     6871 Apr  3 12:04 log.php
-rw-r--r--    1 3671     englishs     5183 Apr  3 12:04 restore.php
-rw-r--r--    1 3671     englishs     8896 Apr  3 12:04 restore_check.html
-rw-r--r--    1 3671     englishs    15330 Apr  3 12:04 restore_execute.html
-rw-r--r--    1 3671     englishs    14898 Apr  3 12:04 restore_form.html
-rw-r--r--    1 3671     englishs     1298 Apr  3 12:04 restore_precheck.html
-rw-r--r--    1 3671     englishs   231377 Apr  3 12:04 restorelib.php
-rw-r--r--    1 3671     englishs     1291 Apr  3 12:04 try.php
-rw-r--r--    1 3671     englishs      465 Apr  3 12:04 version.php

For the data directory:
drwxrwxrwx   11 3671     englishs      512 Apr  8 01:33 .
drwxr-xr-x    9 3671     englishs      512 Apr  7 09:27 ..
drwxrwxrwx    3 80       englishs      512 Apr  4 23:34 1
drwxrwxrwx    4 80       englishs      512 Apr  4 17:04 2
drwxrwxrwx    4 80       englishs      512 Apr  8 18:44 3
drwxr-xr-x    2 3671     englishs     1024 Apr  3 11:57 admin
drwxr-xr-x    3 3671     englishs      512 Apr  3 11:59 auth
drwxrwxrwx    2 80       englishs      512 Apr  4 07:30 cache
drwxrwxrwx    2 80       englishs      512 Apr  9 04:53 sessions
drwxrwxrwx    3 80       englishs      512 Apr  4 02:00 temp
drwxrwxrwx    5 80       englishs      512 Apr  8 01:31 users

And for the moodle directory: vle
drwxrwxrwx   25 3671     englishs     1024 Apr  9 01:03 .
drwxr-xr-x   27 3671     englishs     4608 Apr  7 12:31 ..
-rw-r--r--    1 3671     englishs      943 Apr  3 15:56 README.txt
drwxr-xr-x    2 3671     englishs     1536 Apr  3 12:02 admin
drwxr-xr-x   14 3671     englishs      512 Apr  3 12:03 auth
drwxr-xr-x    4 3671     englishs     1024 Apr  3 12:04 backup
drwxr-xr-x   23 3671     englishs     1024 Apr  3 12:08 blocks
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:09 calendar
-rw-r--r--    1 3671     englishs    15297 Apr  3 15:56 config-dist.php
-rw-r--r--    1 3671     englishs    15384 Apr  9 01:03 config.php
drwxr-xr-x    3 3671     englishs     1024 Apr  3 12:09 course
drwxr-xr-x    3 3671     englishs      512 Apr  3 12:10 doc
drwxr-xr-x    8 3671     englishs      512 Apr  3 12:11 enrol
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:11 error
-rw-r--r--    1 3671     englishs     5931 Apr  3 15:56 file.php
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:11 files
drwxr-xr-x   10 3671     englishs      512 Apr  3 12:12 filter
drwxr-xr-x    2 3671     englishs      512 Apr  3 12:12 grade
-rw-r--r--    1 3671     englishs     4964 Apr  3 15:56 help.php
-rw-r--r--    1 3671     englishs     7677 Apr  3 15:56 index.php
-rw-r--r--    1 3671     englishs    23775 Apr  3 15:56 install.php
drwxr-xr-x   77 3671     englishs     1536 Apr  3 15:28 lang
drwxr-xr-x   17 3671     englishs     1536 Apr  3 15:37 lib
drwxr-xr-x    2 3671     englishs      512 Apr  3 15:37 login
drwxr-xr-x    2 3671     englishs      512 Apr  3 15:37 message
drwxr-xr-x   17 3671     englishs      512 Apr  4 00:22 mod
drwxr-xr-x   10 3671     englishs      512 Apr  3 15:51 pix
drwxr-xr-x    2 3671     englishs      512 Apr  3 15:51 rss
drwxr-xr-x    3 3671     englishs      512 Apr  3 15:51 sso
-rw-r--r--    1 3671     englishs  2923484 Apr  3 15:57 tags
drwxr-xr-x   15 3671     englishs      512 Apr  3 15:56 theme
drwxr-xr-x    3 3671     englishs      512 Apr  3 15:56 user
drwxr-xr-x    2 3671     englishs      512 Apr  3 15:56 userpix
-rw-r--r--    1 3671     englishs      514 Apr  3 15:56 version.php

Thanks for any advice  and for helping me sort this out.

Norbert


In reply to Norbert Berger

Re: chmod() error messages !Solved!

by Thomas Greene -

Change the permission in your config.php to 00755.

Thanks to you I now understand a good deal about permissions.

Thomas

In reply to Thomas Greene

Re: chmod() error messages !Solved!

by Norbert Berger -
Hi Thomas

Thanks for your advice. Tried to update and found all directories and files had disappeared off the web and off ftp. According to Vdeck, the files are still there, but not accessible online on some machines. While on another, I can still see it. Totally confused now.

Norbert
In reply to Thomas Greene

Re: chmod() error messages !Solved!

by Norbert Berger -
Hi Thomas

Two things now: First of all, a very big thank you: Your suggestion resolved the issue. 00755 is perfect. I wonder why. If you have any time left, could you share what you learned? I'd be very happy to provide materials or anything else that might be useful for your students in Korea.

Secondly, my message a minute ago was caused by some name server changes somebody else has made regarding the site, all of which had nothing to do with my original problem. Just a coincidence.

Many thanks for your help again.

Norbert
In reply to Norbert Berger

Re: chmod() error messages !Solved! but warning about moving file still there.

by Norbert Berger -
Hi Thomas

Thanks again. Business English Direct.com is fine, but I still get a warning message about moving a file when I upload a pciture of englishstudydirect.com. the chmod message has been reolved.
It seems there may be an issue with the name server entries for that site, though. Not sure whether than could have anything to do with it.


Norbert
In reply to Norbert Berger

Re: chmod() error messages

by Daniel Ward -

Hi - I have a similar problem.

I have chmod 777 the uploadlib.php and also the directory called files and still no joy..  screen shot attached

can anyone offer any words of wisdom?

Thanks Daniel

Attachment screenshot.JPG