File upload size

File upload size

by Kirk Preston -
Number of replies: 4

Hi,

I've taken the plunge and now running the latest version of  moodle (3.4) on a virtual linux machine.  I'm trying to follow the guide for changing the file upload size at https://docs.moodle.org/34/en/File_upload_size but are running into problems. Gnu nano tells me the file does not exist  for sudo nano /etc/php5/apache2/php.ini and the same if I change it to sudo nano /etc/php7/apache2/php.ini. I have browsed to the file  but it is in read only format and I am not the owner. I need to be able to upload some videos so was looking to set the upload size to 1GB as this should be enough. How do I change permissions from read only so I can edit the file and save it after the changes?


Average of ratings: -
In reply to Kirk Preston

Re: File upload size

by Ken Task -
Picture of Particularly helpful Moodlers

Look at your moodle instance server php-info link.   That will show what version of PHP is being used by the apache server and thus Moodle.

Look for the path to the php.ini ... that's the one that needs editing.

However, you might need to find out and share back which linux ... Ubuntu/CentOS ... version of that as well.   There's enough of a difference to make  a difference in the blogs/resources/moodle docs you read and attempt to follow.

As well as what type of hosting ... virtual linux ... could be a lot of things ... shared, VPS, managed, unmanaged, a VPS allocated by WHM, for examples.

Since you can 'browse' to files does that mean you are using cPanel?

Might check into FAQ's/How-2's etc. your hosing provider might have on line.

'spirit of sharing', Ken


In reply to Ken Task

Re: File upload size

by Kirk Preston -

Hi Ken,

Ubuntu 16.04 LTS is version of linux that I am running as a virtual machine on my desktop. When I say browse I am looking through the files  using the file manager in Ubuntu. I can see two php.ini file and both are locked, one is in /etc/php/7.0/apache2 and the other is etc/php/7.0/cli and I am not the owner of the both the files. Hope this information helps

In reply to Kirk Preston

Re: File upload size

by Ken Task -
Picture of Particularly helpful Moodlers

Thanks.   That does help.

When you login to the desktop you should be logging on as a sudo user ... like kpreston (what ever account you set up upon initial install of Ubuntu.

When you browse files using file manager you are that user, but that user doesn't have credentials/level of access to edit either of those php.ini's.

Open terminal.   At the user prompt, it might show: kpreston type in:

sudo -s

The -s means stay as root user in a sudo session.

You will be prompted to give your kpreston password.

If kpreston is in sudoers, the prompt will change to root:

Now change diretories to the location of the php.ini file you desire to edit.

cd /etc/php/7.0/apache2/

Look at ownerships/permissions on php.ini

ls -l php.ini

It *might* show you something like:

-rw-r--r--. 1 root root 62660 Oct 21 12:57 php.ini

r means read

w means write (can edit)

x means execute - file if set to execute will do something if called.

The root:root above is the owner of the file and group - thus rw- (no x) applies to php.ini

This means as root user, the php.ini file can be edited.

So...

nano php.ini

Should allow you to open, edit, and save the file.

There are two settings you need to change to increase the size of a file to be uploaded:

post_max_size

and

upload_max_filesize

Set those to = 1G

Save the file

Restart the apache 2 service.   Must do this for Moodle to recognize new values.

To exit the terminal, you must type: exit twice ... once to get out of root and again to close the user session.

Login to the Moodle and check the settings on a course for uploads.

You might want to bookmark/favorite: https://help.ubuntu.com/

specifically the link to 16.04 or download the PDF for local reference.

'spirit of sharing', Ken




Average of ratings: Useful (1)