Archive for 02/2010

[Apache] mod_deflate: Reduce the load time of your pages


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (1 votes, average: 5.00 out of 5)
Loading ... Loading ...

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 »

Compress files with PHP


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (2 votes, average: 3.00 out of 5)
Loading ... Loading ...

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:

  1. <?
  2. / **
  3. * Inserts a file within a zip.
  4. *
  5. * @ Param string $ name name_of_zip ZIP file that will be worked.
  6. * @ Param string $ path_file Path original file that goes to the ZIP
  7. * @ Param string $ file_name file name inside the ZIP
  8. * @ Return Mixed
  9. * /
  10. $name_of_zip = null , $path_file = null , $file_name = null ) { fileToZip function ($ name_of_zip = null, $ path_file = null, $ file_name = null) (
  11. empty ( $name_of_zip ) || empty ( $path_file ) || empty ( $file_name ) ) { if ( empty ($ name_of_zip) | | empty ($ path_file) | | empty ($ file_name)) (
  12. ; return 'All parameters are required';
  13. )
  14. / / Create an instance of the ZIP
  15. ZipArchive; $ Zip = new ZipArchive;
  16. / / If unable to create the ZIP file
  17. $zip -> open ( $name_of_zip , ZIPARCHIVE:: CREATE ) === true ) { if ($ zip -> open ($ name_of_zip, ZIPARCHIVE:: CREATE) === true) (
  18. / / Add the file in the zip
  19. ( $path_file , $file_name ) ; $ Zip -> AddFile ($ path_file, $ file_name);
  20. ( ) ; // fecha a conexão com o ZIP $ Zip -> close () / / close the connection to the ZIP
  21. / / Optionally you can delete the original file, just insert a variable in the parameters
  22. / / Unlink ("/ path / to / file / file.php ');
  23. ; return true;
  24. { Else ()
  25. ; return false;
  26. )
  27. )
  28. ?>

Read the rest of this entry »

[Quickie] PHP - Do not write files. "Inc '


1 Estrelas2 Estrelas3 Estrelas4 Estrelas5 Estrelas (2 votes, average: 5.00 out of 5)
Loading ... Loading ...

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:

config.inc sendo exibido no Firefox Read the rest of this entry »

Get Adobe Flash player Plugin by wpburn.com wordpress themes