Accessing php.ini on a virtual machine

681 views
Skip to first unread message

Chloé Hendrickx

unread,
Apr 17, 2017, 8:03:58 AM4/17/17
to islandora
Hello,

I'm dabbling with Islandora for a school project. I used the virtual machine configuration as I do not possess the skills to install it otherwise. I would like to access the php.ini file to modify the maximum size of uploaded files as I'm working with WARC files that have a 600-800 Mb size.
Do you know how I could access, open and save the php.ini file from the virtual machine ?
I tried this command without success :

find . -name php.ini

Is it even possible to modify the php.ini in the virtual machine environnement ?

Many thanks,

Chloé Hendrickx
HE2B - IESSID
Message has been deleted

Danny Lamb

unread,
Apr 17, 2017, 8:08:38 AM4/17/17
to isla...@googlegroups.com
Chloe,

The 'php --ini' command will show you which inI file is being used. Typically there's one for command line use (cli) and one for the webserver (apache2). Once you find out where the Apache inI file is, you can edit it with any Linux text editor. 'nano' is probably the easiest to get started with.

~Danny

On Apr 17, 2017 9:03 AM, "Chloé Hendrickx" <chloehe...@gmail.com> wrote:
Hello,

I'm dabbling with Islandora for a school project. I need to upload WARC file that excess the maximum file limit (most of them are between 600-800 Mb). I'm using the virtual machine configuration as I do not have the skills to install Islandora otherwise. I would like to change the php.ini to modify the maximum size of my uploaded files.
Do you know which commands I may use to access, open and save the php.ini file ?

Many thanks,

Chloé

--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/islandora.
To view this discussion on the web visit https://groups.google.com/d/msgid/islandora/b3f212ba-6cf5-42a5-9527-640b05727e44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jared Whiklo

unread,
Apr 17, 2017, 8:24:44 AM4/17/17
to isla...@googlegroups.com
IIRC, it's in

/etc/php.d/5.6/apache2

But if that is not exactly correct it should get you started.

Cheers,
Jared

Chloé Hendrickx

unread,
Apr 17, 2017, 8:37:35 AM4/17/17
to islandora

Dear Danny,

Thank you so much for your answer! Unfortunately, it appears I only have the one for command line use. The results of the 'php-ini' command are in the capture above. Is it normal?

Chloé


Le lundi 17 avril 2017 14:08:38 UTC+2, Danny Lamb a écrit :
Chloe,

The 'php --ini' command will show you which inI file is being used. Typically there's one for command line use (cli) and one for the webserver (apache2). Once you find out where the Apache inI file is, you can edit it with any Linux text editor. 'nano' is probably the easiest to get started with.

~Danny
On Apr 17, 2017 9:03 AM, "Chloé Hendrickx" <chloehe...@gmail.com> wrote:
Hello,

I'm dabbling with Islandora for a school project. I need to upload WARC file that excess the maximum file limit (most of them are between 600-800 Mb). I'm using the virtual machine configuration as I do not have the skills to install Islandora otherwise. I would like to change the php.ini to modify the maximum size of my uploaded files.
Do you know which commands I may use to access, open and save the php.ini file ?

Many thanks,

Chloé

--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.

Danny Lamb

unread,
Apr 17, 2017, 9:03:33 AM4/17/17
to isla...@googlegroups.com
Ah yeah, I guess if you're running it from the command line, only cli will show up. If you look at the output, your files for cli are in /etc/php5/cli. Is there a /etc/php5/apache2 directory? That should be where the ini files for the webserver are located. 

Oh, and I forgot to mention, after updating the apache2 ini, you'll need to restart Apache. You can do it with 'sudo service apache2 restart'.

To unsubscribe from this group and stop receiving emails from it, send an email to islandora+unsubscribe@googlegroups.com.

Chloé Hendrickx

unread,
Apr 17, 2017, 9:33:50 AM4/17/17
to islandora
I have no other choice than to run it from the command line as it is what the Virtual Machine opens. I can't seem to find any directory at all. When I use the "ls" command, the only result is "drush-6.3.tar.gz". I have no results when I use the "find" command. I tried to find it under the /tmp directory from my computer (as it is supposed to be the place were the virtual machine puts all temporary files from the virtual machine) but no results as well.

Daniel Lamb

unread,
Apr 17, 2017, 9:42:16 AM4/17/17
to isla...@googlegroups.com

Chloe,

You can pass arguments to the 'ls' command.  So 'ls /etc/php5' should list all the directories contained in that folder.  You can enter them with the 'cd' command.

But just hang on a sec and I'll try to recreate the steps myself on a vagrant box.  I should be able to give you a complete list of commands to just run so you don't lose weeks teaching yourself linux just to try this out.

~Danny

dp...@metro.org

unread,
Apr 17, 2017, 9:52:09 AM4/17/17
to islandora
Hi Chloe,

You can see the location and the settings directly from Drupal
Look here
It is under localhost:8000//admin/reports/status

Cheers

Diego Pino 
Metro.org

Chloé Hendrickx

unread,
Apr 17, 2017, 9:54:29 AM4/17/17
to islandora

Thank you so much Danny! I didn't know it was possible. I could list the directories but I was unable to enter them (see image above).
I'm using the .ova file available on the Islandora downloads page. I've monted it with VirtualBox.

Chloé

Daniel Lamb

unread,
Apr 17, 2017, 11:04:06 AM4/17/17
to isla...@googlegroups.com

Looks like you're missing the preceding '/' in that last command.  It should be 'cd /etc/php5/apache2'.

Here's some commands to find out the upload_max_filesize for your install and how to change them.

  • grep 'upload_max_filesize' /etc/php5/apache2/php.ini

This will print out what it's currently set to.  I received "upload_max_filesize =500M".  Note the space before the equals sign.

To change it, I used sed, which can be used to update chunks of text.

  • sudo sed -i 's/upload_max_filesize =500M/upload_max_filesize =2G/' /etc/php5/apache2/php.ini

Note the space before the =, again.  It has to match exactly what got printed out, so if you get different results, you'll need to adapt accordingly.  This sets the max upload size to 2 gigabytes.

I would repeat this process for some other common parameters related to working with large files.  For example, I did the same for 'post_max_size':

  • grep post_max /etc/php5/apache2/php.ini

Which got me 'post_max_size =500M'

  • sudo sed -i 's/post_max_size =500M/post_max_size =2G/' /etc/php5/apache2/php.ini
Again, 2 gigabytes, just to be safe. 

And 'max_execution_time'
  • grep 'max_execution_time' /etc/php5/apache2/php.ini

Which got me 'max_execution_time =100'.  So my sed command was

  • sudo sed -i 's/max_execution_time =100/max_execution_time =0/' /etc/php5/apache2/php.ini

Setting that to 0 removes any sort of limit on execution time.

You can use the 'grep' commands above to check your work to make sure the changes are made.  And then to get them to take effect,
  • sudo service apache2 restart

You ought to be able to copy/paste your way through this knowledge.  Hope that helps.

~Danny

Reply all
Reply to author
Forward
0 new messages