Bandwith Speed โ€‹โ€‹Boost Tips for PHP5 Servers: Zlib Output and Compression

I have some detailed, specialized questions about the nature of the settings that go into htaccess when setting up the PHP range with savings and an effective increase in speed :

Let me thank you in advance for your answer and clarification on this, since I do not understand the directories of apache-documents in an encyclopedic style

Below is an example that actually runs on my Apache 2.0 and PHP 5.2.3

# preserve bandwidth for PHP enabled servers <ifmodule mod_php4.c> php_value zlib.output_compression 16386 </ifmodule> 

.

Q1: Does ifmodule mod_php4.c it for PHP 4, not PHP5?

Q2: Would it be faster if the server engine had this in php.ini instead of htaccess?

Q3: By default, 16386 used for compression. What happens if we omit it, say 4K

Q4: What happens if we install it higher, for example. 128K ?

+4
source share
1 answer

Q1: Can ifmodule mod_php4.c offer it for PHP 4, not PHP5?

Yes. RUN . PHP4 has no reason to install unless you have scripts to be broken under PHP5.

Q2: Would it be faster if the server engine had this in php.ini instead of htaccess?

To start Apache, one iota should not matter except for a few opcodes. There is no point ... if the .htaccess file has not yet been present, in which case a slight performance hit may occur, since Apache finds the file. (Less .htaccess files => less needless stat calls => better performance for everything.)

Q3: By default, compression is set to 16386. What happens if we lower it, say, to 4K

This is the size of the output buffer . If you put it on 4k, the data will be sent a little earlier. Depending on the average page size, this may mean that the data can be sent in several fragments, which can be a very slight decrease in performance for the user receiving the data.

Q4: What happens if we install it higher, for example. 128K?

This means that 128k buffering will occur before data is sent to the client. If your pages exceed 128 thousand Post-gzipping, something may be wrong.

PHP bandwidth change settings and effective speed increase:

Some time ago, people started recommending not using the built-in gzip PHP, instead offering Apache mod_deflate . This allows PHP to simply take care of HTML generation and allows Apache to worry about compression and maintenance. It also has the same effect. Although the manual page for mod_deflate is encyclopedic, it is also simple and straightforward. Perhaps you already have this, and you just have the necessary lines that are not used in your httpd.conf.

Since it can work at the โ€œfilterโ€ level, using it also means that anything that creates compressed MIME types, including CGI scripts and plain old HTML files, can be automatically loaded by gzipped.


Update with comments replies:

I correctly and correctly read the lines that you suggested that I delete block A and block only block B in as shown here

This is usually correct, although your configuration block currently uses extension targeting files. Instead, you can configure the MIME type using the AddOutputFilterByType configuration AddOutputFilterByType , as described in the mod_deflate manual.

When removing the PHP configuration, also check php.ini on your system, as it may also contain compression directives that you might not need.

Apache will be smart enough not to duplicate content, no matter what method you use to enable mod_deflate.

What would be the right way to modify block A to make it most compatible with PHP5?

It depends on which version of mod_php version 5.x is invoked on your system. It will be just plain old mod_php or mod_php5. Locate the LoadModule directive elsewhere in httpd.conf (or in the /etc/httpd/conf.d/*. Conf file).

The actual configuration directive is correct, it is simply wrapped in the "do this only when loading PHP4" block.

Say your 5.x mod_php is called mod_not_butter . If so, the block will look like this:

 <IfModule mod_not_butter.c> php_value suckitude_factor -1 </IfModule> 

I wonder what other parameters I could tweak / speed up the processing of mod_deflate APACHE gzip

There are many options. Do not touch any of them except the buffer size ( DeflateBufferSize ), which you should set to the average uncompressed data size that you expect (Earlier, I forgot that the buffer was after compression, but it actually was earlier.)

All other parameters are the correct default values โ€‹โ€‹that you donโ€™t need to touch, because by the time they change your performance in a significant way, youโ€™ll want to use other technologies to boot from Apache.

+6
source

Source: https://habr.com/ru/post/1345006/


All Articles