Compress PHP script before uploading to the main server

How can we compress php script before uploading to the main server so that our website becomes so fast as to view and reduce page load time.?

Thanks.

+4
source share
4 answers

You can not. You probably wanted to compress the output of your website. You can add a GZIP mod handler to your Apache configuration if you run your site on Apache. Add the following to your .htaccess file:

# compress text, html, javascript, css, xml: AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript # Or, compress certain file types by extension: <Files *.html> SetOutputFilter DEFLATE </Files> 
+6
source

PHP runs completely on the server side, so compression will not reduce page load time.

+12
source

Compressing a PHP file will not speed up its execution time.

By default, PHP will read the entire file every time, compile it into bytecode, and then run that bytecode.

What you're probably looking for is a bytecode cache, like APC . It will cache the bytecode that is generated, so it does not need to be created every time.

+4
source

We used NuSphere PhpExpress, a free PHP accelerator (http://www.nusphere.com/products/index.htm). It compiles PHP. It also requires an extension for the server. It speeds up the creation of pages (LITTLE), and also protects them from "sharing" (because the code is "hidden").

There are more effective ways to increase the speed of your website (see a post from TheGrandWazoo) or if you have optimized your database table, queries, and pages whenever possible.

+1
source

All Articles