copy of php.ini goes where?

copy of php.ini goes where?

by Jeanine Lum -
Number of replies: 21
I needed to increase my upload_max_filesize in my php.ini , which I did, and nothing happened.

My webhost says I need to copy the php.ini file into the folder where the script (resides) is called up in order for the changes to take place.

Currently, my php.ini sits in my public_html

Does anyone know which folder in the moodle file structure this would be?

I suppose I could put it in every directory but I barely know what I doing as it is!

thank you,

Jeanine
Average of ratings: -
In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Heather Barton -

Hi Jeanine,

Typically the php.ini file would reside in the Apache folder (on our linux server /etc/php5/Apache2/).. presuming you are using Apache as your webserver.

I'm not sure where else you would put it to override your hosts php settings though.

Heather

In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Steve Hyndman -

Who is your host? I have a test account with Bluehost and know how to do it with them, but that process may or may not work on another host.

Steve

In reply to Steve Hyndman

Re: copy of php.ini goes where?

by Jeanine Lum -
I am using Blue Host as well!


In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Steve Hyndman -

Okay, here is what you need to do.

1. Open the php.ini file provided by bluehost and change the post_max_size and the upload_max_filesize to the value you want. So, to increase the maximum to 50 meg, they would need to be like this:

upload_max_filesize = 50M
post_max_size  = 50M

Don't change anything else and save the changes.

2. Leave this in your public_html root and also copy it to the following locations...this is assuming Moodle is installed in a directory called moodle:

-- moodle/admin
-- moodle/course
-- moodle/files

3. Also, copy this to the root of your moodledata directory.

Now, log into Moodle and go to Site Administration/Security/Site policies and change the "Maximum uploaded file size" to either "Server Limit" or your new max limit and save.

That should do it.

Just write this down somewhere so when/if you upgrade you can add php.ini back to the appropriate directories.

Steve

Average of ratings: Useful (3)
In reply to Steve Hyndman

Re: copy of php.ini goes where?

by Robert Vincent -

Hi Steve,

Did all of that and still to no avail.  I am hosting at hostmonster.com and have had the crew help me with this as well, still not resolve  helpl my courses will start in two weeks....

In reply to Robert Vincent

Re: copy of php.ini goes where?

by Steve Hyndman -

I have an account with Bluehost that I use for various testing purposes, so I know this will work there, but I'm not familiar with hostmonster....maybe someone else here has an account with them and can help you.

Steve

In reply to Robert Vincent

Re: copy of php.ini goes where?

by Marc Grober -
I took a look at the php info published in their knowledge base and it looks like they have never fully addressed the changes that came with php5 (I am suggesting this because copying a php.ini file to all directories was something that you did with php4, and they want you to make a special selection for php5, as opposed to that being a default. http://helpdesk.hostmonster.com/kb/index.php?mod_id=2&kb_keywords=php.ini

I would have to suggest that this is going to continue to be an uphill battle for you. There is a thread in the moodle forums about searching for a web host that supports php5, custom php.ini etc and you may want to review that discussion and consider finding a new new weh host who is more aggressive with reagdr to supporting php5, etc.
In reply to Steve Hyndman

Re: copy of php.ini goes where?

by Matthew Hayman -
This worked for me, thanks so much.

I'm on 1&1 hosting and have tried numerous approaches.
In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Marc Grober -
I think typically you would want to put this in your cgi-bin. You would be copying your php.ini and php.cgi files from your web hosts system directory to your cgi-bin, then changing .htaccess along this line:

Add Handler php-cgi .php
Action php-cgi /cgi-bin/php.cgi

to add a local handler and when a call to a .php file comes in to your web site, it is directed via your htaccess file to php.cgi which points to your local php.ini.... or I think so the theory goes. But, you have to use cgi based php not mod-php. And you will have to set correct perms on all the files and directories.
In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Just H -
Hi Jeanine

Glad Steve helped you to fix it up but thought I'd post in case others are having the same issue in the future.

If you want to create a modified php.ini on shared hosting (and you are allowed to!) I have found Tip 1, under "Using PHP" on this site to be the easiest way.

If for some reason you need to have php.ini in each directory (e.g. running PHP 4 or your host has it set up that way), use Tip 2.

If you upgrade to PHP 5 and you no longer need a php.ini in each directory, use Tip 3.

regards
H
In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Marc Grober -
This How To http://wiki.dreamhost.com/Custom_PHP.ini from dreamhost should explain what I mean.....
But you need to determine whether you are running php4 or php5.
The solution works very well, is very clean and should work (once you have adjusted for the actual locations of files) as long as you are not running mod_php (as that circumvents the cgi bit....) the files referenced are not secured so you can download them as well.... and setting up as suggested should not mess up anything in your existing installation.


In reply to Marc Grober

Re: copy of php.ini goes where?

by Richard Enison -
MG,

I got e-mails from this forum containing copies of posts with the subject How To vs Forum Thread. Some of these were from you. The last of these was from you, with the URL http://moodle.org/mod/forum/discuss.php?d=94601#p418701. So I clicked on the "See this post in context" link, which tried to take me to that URL, but instead it took me to this thread, which does not contain any of the "How To..." posts. Apparently someone pretending to be a moderator split those posts off and I never got the memo!

Not only that, but this thread contains one of my posts, which I was going to mention in my post in the split-off thread.

RLE
In reply to Richard Enison

Re: split thread (was copy of php.ini goes where?)

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Richard,

Sorry for the problems caused by splitting this thread. The discussion How To vs Forum Thread can now be found in the Moodle.org design forum.
In reply to Helen Foster

Re: split thread (was copy of php.ini goes where?)

by Marc Grober -
Ahhhh, but this begs an intriguing question! (actually two if the question of where this post should be posted is considered a question..... i. e. should this post be moved to the forum module forum?)

In any event, the primary (?) question would be, "If you use the split or move feature of the moodle forum, does it change a post's or a thread's URL(s)?" If so, this is arguably very bad!

For instructional purposes, could you explain what you did (operationally, mechanically, logically, etc) so I can make sense of this?
In reply to Marc Grober

Re: split thread (was copy of php.ini goes where?)

by Richard Enison -
MG,

I thought my previous post in this branch of the thread made it clear that I followed the URL in my e-mail which is presumably where the split post used to be, and it went nowhere, so evidently the new post in the new forum has a new URL.

It is unclear to me whether your post is addressed to me, HF, or someone named Don (he is mentioned in a later post of yours). I'm guessing you meant Don Hinkelman, who added several posts in the new split-off thread. I think HF's apologetic post implies that she's the culprit here.

RLE
In reply to Richard Enison

Re: split thread (was copy of php.ini goes where?)

by Marc Grober -
Sorry for any confusion. Your post was very clear, which is one reason I asked in the new location for this thread about how Moodle manages the URLs because if any split or move effects the URLs as your post suggests, I think this is a major problem for the reasons you discovered.

My posting (the one to which you are replying), was actually posted in response to Helen's posting about the move.... asking her to confirm that in fact your problem was the result of the split/move altering the URL of the postings...

And, as I think you suggest, there are a number of other posts still entangled in this thread relating to this issues.... all my fault as I probably should have moved the further discussion to another forum, though I did not for reasons plead elsewhere.
In reply to Richard Enison

The case of the missing post....

by Marc Grober -
LOL, well, someone has apparently decided to demonstrate what happens if you split something off in moodle forum without leaving a place holder.... I have only done that kind of thing in hypernews, which heals those "wounds" by redirection... I am off to earn my daily bread but will sniff about..... If I didn't know the first day of April was two weeks ago I would have assumed your post was an April Fools joke....

Don, have you obtained hidden powers which you are demonstrating for us??
In reply to Marc Grober

Re: The case of the missing post....

by Steve Hyndman -

Splitting isn't the real problem. The real problem is people completely changing the subject of a thread.

People should start a new thread when they want to talk about a "different topic"...otherwise they should leave the original subject alone other than maybe adding something like "solved" to it to indicate the status.

Steve

In reply to Jeanine Lum

Re: copy of php.ini goes where?

by Richard Enison -
JL,

Along with the others I'm glad you found the file and solved your problem, but for the sake of other readers of this forum who are trying or will be trying to find their php.ini file, ...

So far this post has started the same as several others in this thread. But they all have one thing in common. They all claim to know where the file is, at least under certain particular circumstances (php version, o/s, host, etc.) or they refer the reader to web pages that do so. Now here's the whole story:
  1. If you are using php4 you need a php.ini file in every folder (directory) with php script files.
  2. If you are using php5 or higher, there may be many php.ini files on your server (possibly left over from php4), but only one is the active one. Modifying any copy other than the active one will do absolutely no good whatsoever. To find the active one, do the phpinfo thing. In the output, near the top of the page, is an item labeled Configuration File (php.ini) Path. This will tell you exactly where the active file is. It's as simple as that.
I wish I had a (US) dollar for every time I have posted the above instructions in this forum. big grin And I'm not the first, either!

RLE
In reply to Richard Enison

Re: copy of php.ini goes where?

by Marina Pindar -

JL, I really appreciate your post. I know it is quite old. But I happen to be in that same situation, not being able to find where the php.ini file is located. I have installed moodle in a subfolder of  domain.com/campus. I have no access to the public folder. When I do the info.php thing I get this info. What is strange is that the file seams to be located on my computer instead of being on the server.. is that so? I am just a teacher so i don't know much about this.

Thanks.