PHP.ini, requesting help

software development


I’ve been having trouble adding things to my gallery (coppermine), and apparently it’s because my “upload_tmp_dir” setting has no value.

Dreamhost support said that I can change this with my php.ini file, and linked me to this page:
But, I have no idea what any of it means, and it says “Support for these instructions is not available from DreamHost tech support.”

I’ve tried going through the steps, but like I said, I’ve got no clue what it’s saying. (I also tried google-ing the problem, but no luck.)


They’re instructing you to create a custom PHP installation. They don’t support it (that means they won’t do it for you, and if you decide to do it anything you stuff up is your problem). There are many people here at the forum who will help out if something goes wrong.

Did you run through the process described in the Wiki using a shell account?


Yea, but I’m stuck on making the actual php.ini file and enabling it, so basically the whole process.


If you follow the instructions in the wiki page you referenced in your earlier post, you won’t need to “make” the actual php.ini file; it is copied for you from the DreamHost default to a php.ini file in your own directory space.

All you have to do is edit that to change the settings to meet your needs.

All you could ever want to know about the php.ini file is on the website (though most of what you should need is also on the DreamHost wiki).

You “enable” it with the later steps in that wiki article. It’s the .htaccess file modification that “enables” it for your site. :wink:

In short, follow the instructions in the wiki. If you don’t understand a step, fire up Google or post here, to get the help you need to understand what you are doing before you proceed. It’s not as hard as you think, but you do have to actually “do it”.



Well, my intention is to use the Dreamhost example my file, but I don’t know how to add upload_tmp_dir to the file.

So the first thing I need to know is if this is anywhere near accurate:

rsync -a /dh/cgi-system/php5.cgi “$CGIFILE”


cp /etc/php5/cgi/php.ini “$INIFILE”

perl -p -i -e ‘
s/.upload_tmp_dir./upload_tmp_dir = /tmp;

There are 2 there, and the second makes even less sense but is called the “More general script with options” should I use that one?

I also did attempt to follow the steps, but my site actually stopped working, so I’m pretty sure I did that wrong.

It talks about “Execut[ing]… commands into the shell”

Do I do this first? I tried but I got an error saying something about improper commands.

And, as I’ve said I’ve been trying to google sites for a while now, but even if they do give directions, they are all vastly different than the Dreamhost version.


So, I’ve found this post here:

that makes more sense as I read through the thread, but I’m confused about how to do this:

Then do:

chmod +x php_update


It looks like you have the right idea! :wink:

[quote]There are 2 there, and the second makes even less sense but is called the “More general script with options” should I use that one?
No, if you don’t understand what the first one is doing, then don’t tackle the second one just yet. :wink:

If you really want to do this, I’ll explain it as best I can. Don’t get discouraged by what looks to be a very complicated explanation that follows. It is not all that hard, and is in fact actually easier to do, once you understand it, than it is to explain it. :wink:

First you need to understand what the script you are running is doing before you can understand how to modify it from it’s intended purpose (changing the setting impacting the maximum uploadable file size) to your purpose (assigning a directory to upload_tmp_dir), so let’s break it down:

The first three lines of the script… #!/bin/sh CGIFILE="$HOME/" INIFILE="$HOME/"… are simply setting the “shebang” so the script can run, and assigning some values to variables for later use in the script.

The next line … rsync -a /dh/cgi-system/php5.cgi "$CGIFILE" … is using the “rsync” command to copy the default DreamHost php.cgi file from it’s default location and placing a copy of that file into your user space (as defined previously in line 2 of the script).

The next two lines … # REMOVE THE FOLLOWING LINE TO CREATE THE UPDATE-ONLY SCRIPT: cp /etc/php5/cgi/php.ini "$INIFILE"… are just a comment explaining that the “next line” should be removed when you create the “update-only” script later in the article, and the line that uses the “cp” command to retrieve a copy of the of the default DreamHost php.ini file from it’s standard location and place it into the proper place in your user space (as defined in line 3 above of the script).

The next four lines of the original script (in the wiki article) …perl -p -i -e ' s/.*post_max_size.*/post_max_size = 100M/; s/.*upload_max_filesize.*/upload_max_filesize = 100M/; ' "$INIFILE" … use perl to perform two edits in the php.ini file you copied to your user space in the first part of the script. This is the first place you are likely having problems if you don’t really understand what is being done, because for these lines to work, they have to be appropriate for the change you are trying to make.

The wiki version has the appropriate perl substitutions FOR THE php.ini SETTINGS it was designed to change, and they were written by a user who had inspected the default php.ini file for the existing settings, and had written the substitutions based on that. This is where you have your problem:

Since the substitution you need to do includes the “/” character, you can’t use the “/” character to “delimit” the search/replace in the expression, hence your code will not work. The following lines will work (because it uses the “pipe” character for the “delimiter”, so the “slash” can be part of the “search and replace”):perl -p -i -e ' s|.*upload_tmp_dir.*|upload_tmp_dir = /tmp|; ' "$INIFILE"Once you have edited your file to make this correction, and you “run” it as instructed in the wiki, the correct change will be made to your copy of the php.ini file. :wink:

Note that you can just run the script without the “perl substitution section”, and just edit the copy of php.ini that is placed in your site’s cgi-bin with a text editor, should you not be able to get a given perl substitution to work. The advantage to this is that you don’t need to know anything about perl; the disadvantage is that you will have to make the php.ini changes whenever you update the php-cgi/php.ini from the DreamHost system. You probably will only do this if you elect to run the update on a regular basis via a cron job as suggested in the wiki, or if you manually update using the php-copy script that does not have the perl substitutions executed. :wink:

Yep! If your site stopped working, you did do something wrong (but it can be fixed).

Hopefully, with the explanation(s) I’ve provided, you can “do it over again” and get it to work. I suggest you take a break, take a deep breath, and work slowly, following the wiki instructions closely (with the changes I’ve indicated above) - it does work! :slight_smile:



[quote]Then do:

chmod +x php_update
Those are just commands that you type from the command line, just like the “./” command that you ran when you ran the first script. :slight_smile:

Note that the php-update script is not absolutely required; it just help keep you “up to date” with the latest and greatest PHP installation that DH may have at any given time.



I get a lot of what you’re saying, but I’m still stuck on how to execute the commands. I’ve read the Wiki, and I’ve read a lot of other information, but I don’t understand how to execute the commands that the Wiki says to execute.

(Thanks btw, for your help so far.)


You “execute” commands from the linux command line (in the shell) by simply typing them at the command line prompt (usually “[yourservername]$” in the bash shell on DreamHost - which is what you are probably using).

For example, to run the “cd” command. type:

cd [color=#00CC00](note that “” means the “Enter key”, you don’t actually type it.)[/color]

To run the mkdir command, type:

mkdir yourdirectoryname [color=#00CC00](note that “” means the “Enter key”, you don’t actually type it.)[/color]

… and so on and so forth. The DH WIki article tells you precisely what you need to type (for instance, the parameters for the chmod command).

Running the script(s) is a bit of a “special case” as it uses a “dot” prefix. the “.” indicates the current directory . For example:

./ [color=#00CC00](note that “” means the “Enter key”, you don’t actually type it.)[/color]

… will attempt to execute the file “” located in your current working directory.

It would probably help if you carefully read this guide to Linux Shortcuts and Commands, at least the Introductory material and the “7.1 Linux essential shortcuts and sanity commands” section (though the rest of the shortish article will likely be very useful and enlightening). It may also help you understand what to type when you receive instructions concerning how to work in the shell, and when reviewing the DH wiki articles (for instance, :wink:



I feel like a punk. lol, but CPG just released an update, proving to me that I never did anything wrong in the first place. I’m 1st going to attempt the new update, and if that works, then I’ll probably not do this lol.

Which is why I’m a punk, but I have a paper due, so I need to have that finished first. When I have the chance, I’ll get to this.

However, I can’t thank you enough for your help. I’m definitely going to read that guide though.


No worries, let’s think of this as a Two Step process.

As far as the Wiki article and your goal is concerned, you aren’t required to try to make a ‘final product’ during this process, all you’re doing is copying the necessary files into your userspace in order for you to have control over your php environment. Think of it as a “first step”.

Follow the article and you’ll be okay :slight_smile:
Cutting from the article and pasting into shell is perfectly fine, even multiple lines!
(you paste in PuTTy simply by right-clicking the screen btw).

Once completed you’ll discover you have your very own php.ini in your folder that you can then edit whenever you want - via the shell or ftp - in order to add/change any lines or additional directives that you require. This would be your “second step”.

Edits to the php.ini are reflected immediately in your environment.