Posted by Marcelo on Sabadini
11/02/2010
Compress files with PHP
Hello, today I will show you how to compress file with PHP. The procedure is very simple, if your server is the 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 Name of file within 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 the instance of 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 connection with 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 on Sabadini
06/02/2010
[Quickie] PHP - Do not write file. 'Inc'
If your Apache server is not configured correctly 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 the arrow of your system settings, such as: Host of the database, username and password.
Saved under the name config.inc.
By accessing this file directly by URL see what happens:
Posted by Marcelo on Sabadini
27/10/2009
2nd Meeting of the PHP MG
OA staff all good?
Today I'm posting the presentation of the lecture that I gave the 2nd Meeting of the PHP MG day 17/10/2009.
How to migrate your development environment for Linux.
Posted by Marcelo on Sabadini
15/07/2009
wget recursive
Good morning everyone!
Today I'm posting another little hint of Linux (you may have noticed that Esto addicted to Linux)! I'll show you how to download files from an FTP recursively. But what is this? Simple! Imagine the following scenario: I have a routine backup of my system.
Suppose my system is hosted at marcelosabadini.com.br / system / and I want to download the entire contents. So would run the following command:
- ://USUARIO-DO-FTP:SENHA@marcelosabadini.com.br/sistema wget-r ftp: / / USER-TO-FTP: SENHA@marcelosabadini.com.br / system
Who does the magic here is the-r option. Here are some interesting options of wget: Read the rest of this entry »
Posted by Marcelo on Sabadini
02/05/2009
1st Meeting of the PHP Group MG
In the last 25 days, was held in Belo Horizonte the 1st Meeting of the MG PHP , which brought together about 250 people from 31 cities.
I had the opportunity to attend the event and was very happy to see the packed auditorium. The event was very good and the networking was even better, I met people who had heard of (and to my surprise people had heard of me
).
To me, the best speech was that of Joachim of PHPrime on SCRUM. See the PDF here .


![config.inc being displayed in Firefox config.inc 300x178 [Rapidinha] PHP Não escreva arquivos .inc](http://marcelosabadini.com.br/blog/wp-content/uploads/2010/02/config.inc-300x178.jpg)
