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 the arrow of your system settings, such as: Host of the database, username and password.
Saved with the name config.inc.
By accessing this file directly by URL see what happens:
Posted by Marcelo Sabadini in
27/10/2009
2nd Meeting PHP MG
OA staff all good?
Today I am posting the presentation of the lecture that I gave at the 2nd Meeting of PHP MG days 17/10/2009.
How to migrate your development environment for Linux.
Posted by Marcelo Sabadini in
15/07/2009
wget recursive
Good morning everyone!
Today I am posting one more little hint of Linux (you should have noticed that Linux esto addicting)! I'll show you how to download files from an FTP recursively. But what good is it? Simple! Imagine the following scenario: I want to do a routine backup of my system.
Suppose my system is hosted at marcelosabadini.com.br / system / and want to download ALL contents. So would run the following command:
- ://USUARIO-DO-FTP:SENHA@marcelosabadini.com.br/sistema wget-r ftp: / / USER-DO-FTP: SENHA@marcelosabadini.com.br / system
Who does the magic here is the-r option. Here's some interesting options of wget: Read the rest of this entry »
Posted by Marcelo Sabadini in
02/05/2009
1st Meeting of the PHP group MG
In the last 25 days, was held in Belo Horizonte the 1st Meeting PHP MG , which gathered 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, met people who had heard (and to my surprise people had already heard of me
).
To me, the best presentation was that of Joachim of PHPrime about SCRUM. See the PDF here .




