Posted by Marcelo Sabadini in
21/02/2010
[Apache] mod_deflate: Reduce the load time of your pages
This article is a hook pulled from the article " Performance - requets less and more cache "of Michael Mafort .
Hello everybody, today I'll talk about a nice Apache configuration. It's mod_deflate .
Well, using mod_deflate is a way to reduce the loading time of a page. But how does he do it?
When Apache receives a request to display a page to compact it before sending to the client and this makes the data traffic is much lower. This is very efficient in HTML pages (but also other types of compact files).
When I talk pages include HTML pages. Php to generate HTML in response ok?
Apache will surely be a little slower to return the HTML for the fact of having to compress the response, but even so the page will load faster.
For anyone who uses Linux is very easy to make this setting: Read the rest of this entry »
Posted by Marcelo Sabadini in
11/02/2010
Compress files with PHP
Hello folks, today I will show you how to compress file with PHP. The procedure is very simple, if your server is with zlib enabled just run a code like this:
- <?
- / **
- * Inserts a file within a zip.
- *
- * @ Param string $ name name_of_zip ZIP file that will be worked.
- * @ Param string $ path_file Path original file that goes to the ZIP
- * @ Param string $ file_name file name inside the ZIP
- * @ Return Mixed
- * /
- $name_of_zip = null , $path_file = null , $file_name = null ) { fileToZip function ($ name_of_zip = null, $ path_file = null, $ file_name = null) (
- ; return 'All parameters are required';
- )
- / / Create an instance of the ZIP
- ZipArchive; $ Zip = new ZipArchive;
- / / If unable to create the ZIP file
- $zip -> open ( $name_of_zip , ZIPARCHIVE:: CREATE ) === true ) { if ($ zip -> open ($ name_of_zip, ZIPARCHIVE:: CREATE) === true) (
- / / Add the file in the zip
- ( $path_file , $file_name ) ; $ Zip -> AddFile ($ path_file, $ file_name);
- ( ) ; // fecha a conexão com o ZIP $ Zip -> close () / / close the connection to the ZIP
- / / Optionally you can delete the original file, just insert a variable in the parameters
- / / Unlink ("/ path / to / file / file.php ');
- ; return true;
- { Else ()
- ; return false;
- )
- )
- ?>
Posted by Marcelo Sabadini in
06/02/2010
[Quickie] PHP - Do not write files. "Inc '
If your Apache server is not configured properly it causes files. Inc is displayed on the screen. Soon, the entire contents of the file is displayed in the browser.
Say you have a file in which arrow settings of your system as: Host of the database, username and password.
Saved with the name config.inc.
By accessing this file directly by URL see what happens:




