Setting up a custom php.ini

software development

#1

Hi,

I need to create a custom php.ini for my website as to debug an issue with my download manager. (files over 400MB or so timeout before being passed on to the user for download)

The two things I’m looking to change are the php-timeout (change to from 60 to 180) and the php-temporary-directory (change from server default of 2GB to a local setting of 10GB)

Does anyone have some guides or suggestions as the best way to go about this?

Thanks


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#2

You don’t have write access to the php.ini file used for the default DreamHost php install, but you can copy the PHP executable and php.ini file to your domain’s web directory and configure your .htaccess file so that this local install is used. The wiki article linked below details this procedure.

Note: You should not attempt this unless you are comfortable with working in the shell.

http://www.wiki.dreamhost.com/index.php/PHP.ini

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#3

Yeah, from what DH tech-support said I need to run everything on my server. And no, I don’t have much experience in shell. However, I’m still going to give it a try and see how it goes as my only other option is to split large files into 250/300MB chunks using WinRAR (which, in the end, might be the best thing to do).


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#4

Hi Mark,

I take it you’ve done a custom php.ini on your server before? If yes, how long does it take yo setup and would you say it could be extremely difficult for someone with little experience to get working? Like I said, I only need to change two things, the php-timeout and temp directory size.

Thanks


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#5

Yeah, I’ve done it a couple of times, but only when I needed to change one of the default settings. Normally, the default settings in the DreamHost PHP4/5 installs work fine for what I do.

How long it takes will obviously depend on how confident you are doing this type of thing. I wouldn’t call the procedure extremely difficult, but it is necessary to follow the instructions in the wiki carefully and precisely. We have had a few posts on the forum where people had problems with the procedure and it invariably turns out that they have skipped one or more steps in the article.

The article does assume at least some knowledge of using the shell. For example, you should have shell access enabled for your user and have some sort of SSH client available before you start. The wiki article linked below has more information on using the shell here at DreamHost.

http://www.wiki.dreamhost.com/index.php/SSH

As I said, the procedure is not too difficult, but following the instructions exactly is important.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#6

Hi again, Mark

I’ve been looking over the wiki pages that you posted on and off the past few days. I’m going to give this a try soon as I need to try and debugg/correct my issue. The only problem is I’m not even sure this will fix my issue, but it is worth a try. (I think this has to do with the php-timeout or the php temp dir/folder size)

Few questions:

  1. Just interested to know, how long does it take you to setup a custom php.ini now that you have done it a few times?

  2. Would you maybe be able to assist me/help me along over MSN Messenger while I set this up? That is, when you had time, and if you would be interested in helping someone with little experience with this sort of thing. (I’m hoping to learn after this first time so I can do it on my own in the future)

  3. Have you ever changed the temp dir/folder in your custom php.ini from the dreamhost server to your own? From what I hear you would have to use .htaccess along with php.ini to make that work. True?

Thank you


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#7

Hi :slight_smile:

It only takes a few minutes at most, once you are accustomed to the procedure. I should note that I personally do not do the cron step, which automatically updates the executable and ini file at regular intervals. I prefer to update the files manually if/when needed.

Unfortunately, I don’t use any immediate messaging software, as I find it distracts me from my regular work, so I would be unable to help you using this method.

However, if you encounter any problems, I am sure we can sort them out here in the forum. There have been a few threads recently where people have attempted this procedure and run into problems (usually by missing a step or two) and, after a debugging process, we have succesfully got them up and working.

I must admit, I have never had a reason to change the temp directory, so I am not familiar with the procedure, but I am sure someone else here on the forum will have some experience in this regard and will be able to help.

I think it is probably best if you concentrate on a working local install of PHP first, then worry about the required ini file changes after that has been achieved.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#8

Part of the reason I think my issue is with the php temp dir/folder is because from what I learned from DH tech-support, my server only has 2GB set aside for the php temp dir/folder. And this is a problem as a few of my videos are near 1GB and my largest is 1.5GB, thus, they fail to pass to the user for download. (files around 400MB or less seem to work most of the time). DH Tech-support said I can change the php temp dir/folder to use my own account’s disk-space, so I would be looking to change it to 25GB or so and see if that works.


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#9

Hi,

Where do I access the command line for shell? I need to enter the two commands.

Thanks


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#10

Firstly, you need to enable Shell access for your user. This procedure is detailed in the wiki article linked below;

http://www.wiki.dreamhost.com/index.php/Enabling_Shell_Access

You then need a Telnet or SSH client (SSH being the preferred option) to log-in to your servers shell and issue commands. More details can be found in the following wiki article;

http://www.wiki.dreamhost.com/index.php/SSH

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#11

As long as you are here, let me ask you:

Does the below line mean that max php-uploads are set to 100MB?
s/.upload_max_filesize./upload_max_filesize = 100M/;

Also, on: |http://www.wiki.dreamhost.com/index.php/PHP.ini| would you suggest I add anything from the “More general script with options:” box?

Thanks


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#12

Yes, the example scripts in the wiki article set upload_max_filesize and post_max_size to 100M (I believe the default is 7MB), because these are the changes most users seem to be interested in.

Not really, the simpler PHP4 or PHP5 scripts shown should suffice. Although you may want to modify them slightly to make the setting changes you want to the php.ini file.

While on this subject; I had a quick look through the default php.ini file and can not see any obvious setting to change the PHP temp directory, although there is a upload_tmp_dir setting, which will set the temp directory used for HTTP uploads.

As I said above, I have never had a need to change the PHP temp directory, so I am not familiar with the procedure.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#13

When I asked, dreamhost support said:

“Yes. In the php.ini file you can set the temp directory path and yes you are welcome to use a directory within your account space: http://wiki.dreamhost.com/index.php/PHP.ini

So I guess it must be in there

“Although you may want to modify them slightly to make the setting changes you want to the php.ini file.”

As of now i’m only looking to change the php-timeout and php temp dir size/location. Would I need those extra settings during the ini copy?


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#14

Well I can’t see any obvious setting in there. You are welcome to have a look yourself, the zip file linked below has both the DreamHost PHP4 and PHP5 default ini files.

http://www.razw.com/php_ini.zip

That depends on whether you follow the steps for creating a cron entry to automatically update the PHP executable and PHP.ini files at regular intervals. If you do create this cron entry, any changes you manually make to the ini file (but not to the update script) will be over-written the first time that cron runs the update script.

Getting back to your original download problem for a moment (I re-read the thread :slight_smile: ); I don’t fully understand why a lack of space in the PHP temp directory, or the PHP timeout value, would be causing you problems with downloads.

How exactly are you managing these downloads? I would have thought that downloads of this size would be handled with straight HTTP links.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#15

Thanks, I’ll look those over.

I use a download manager to control my downloads. Access is controlled based on a member’s forum account. I am also able to control downloads per day and keep download statistics. (I.E, my downloads are not for just anyone who stops by)

After speaking with the manager author, he suggested they changing the php-timeout and/or temp dir size. Also, the script relies on PHP’s built-in functions and the server setup so theres nothing inherent in the script that would limit a download by size.

And last, DH servers only have 2GB set aside for the php temp dir/folder. And this is a problem as a few of my videos are near 1GB and my largest is 1.5GB, thus, they fail to pass to the user for download. (files around 400MB or less seem to work most of the time).


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#16

Fair enough, I (sort of) understand what you are doing. Although, it does seem rather inefficient to be moving large files like that around in preparation for downloading, if that is indeed what your script is doing. Maybe I misunderstood the explanation, but if the size of the temp directory is a factor, then that seems to be what the script is doing.

I believe max_execution_time is set to 30 seconds by default, so if your script takes longer than that to do what it does, I can see how that might cause problems.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#17

I’m lost on the SSH login part

I use CuteFTP and it has “SFTP using SSH2 (Secure Shell)”. However, the SHH Wiki isn’t helping me much as I’m not even able to get logged in.


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#18

I am not familiar with CuteFTP, but I assume it is an FTP client, that just happens to use SSH for secure SFTP sessions. What you need is an SSH client, the wiki article that I posted previously lists some SSH clients for various operating systems. I personally use PuTTY under Windows XP.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#19

This is really a lot to do and take in…lol

Alright, I turned on ssh/telnet access on my account.

Did everything on http://www.phileplanet.com/archives/2006/08/how-to-setup-ssh-on-windows-xp/ (but login part)

Set up the keys and added them to Pageant

Added files to ftp ~/ and to .shh along with chmoding

However, I’m not able to login. Pageant is running but when I click the key listed, nothing happens. What do I put in PuTTY’s hostname box?


Webmaster of
SeraphicGate.com

Save $97 on any DreamHost plan by using promo code: SERAPHICPROMO


#20

You don’t need to setup Pageant and the RSA keys etc. unless you require ‘password less log-in’. For now, I suggest you just stay with logging-in manually via PuTTY.

In PuTTYs hostname field, just enter yourdomain.com, then hit the ‘Open’ button. You will probably see a warning dialog about the server key not being in the registry, just click through this dialog and you should see the log-in prompt from your DreamHost server.

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)