It looks like you have the right idea!
[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.
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.
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…
INIFILE="$HOME/mysite.com/cgi-bin/php.ini"… 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 php-copy.sh 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.
Note that you can just run the php-copy.sh 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.
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!