PHP / Gallery: working around output_buffering?

When installing Gallery 2, during system checks, I get this warning:

“Output buffering is enabled in your php by the output_buffering parameter(s) in php.ini. Gallery can function with this setting […] but Gallery might be unable to serve large files […] some features like the progress bars might not work correctly […]”

I do indeed see that progress bars don’t work; when I start a long server operation, I have to wait at the page from which I started the operation until it completes. That’s a bit annoying.

I’m not very familiar with PHP yet. Does anyone know if there’s a way to override php.ini directives in a way similar to .htaccess files? Failing that, does anyone know why DH has disbled output_buffering, which seems to be a change from the PHP defaults?


You can not change the php.ini file used by the default DreamHost PHP install and I know of no way to override the settings contained within it.

However, you can create your own PHP install and customise the php.ini file that it uses. There are two common ways of doing this.

You can compile your own custom PHP executable, as detailed in the wiki article linked below, but this is a rather complex process.

The second method involves copying the current PHP executable and php.ini file to your home directory where you can make the changes required. See the wiki article linked below.


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


Thanks for your help on this. I’m afraid my Perl skills are seriously lacking. What line should I add to the shell script?

At the moment, there’s the following for the uploads:
perl -p -i -e '
s/.post_max_size./post_max_size = 100M/;
s/.upload_max_filesize./upload_max_filesize = 100M/;

I figure it would be something like:

s/.output_buffering./output_buffering = ON/;

but it’d be good to be confirmed by someone. If that’s right and it works, I’ll add it to the Wiki.


I may be wrong here, but looking at the warning in the original post, it would seem that Gallery 2 is saying that buffering is On and it would prefer it Off, not the other way around.

I just checked the php.ini files used by DreamHost and the default configuration for output_buffering is different between PHP4 and PHP5.

output_buffering = Off;

output_buffering = 4096;[/b]

Adding something like the following to the Perl script in the wiki article should disable output_buffering in PHP5;

s/.output_buffering./output_buffering = Off/;

By the way, I was mistaken in my original reply. I have since learned that you can override some php.ini settings using ini_set within your PHP script.

ini_set(‘output_buffering’, ‘off’);

This could be a lot simpler solution than copying the PHP executable and php.ini file.


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