Shaked Klein Orbach echo 'Just smile';

18Dec/110

PHP Managing zip files with ZipArchive

Posted by Shaked

Requirements

  1. PHP 5.2 or greater (would be a bit sad to know that someone is still using PHP 4) 
  2. Upgrade PEAR to latest version 
  3. Upgrade PECL to latest version 
  4. Installing PHP ZipArchive library by using PECL's zip package

Installation 

I will use pecl to install ZipArchive PHP library.

  1. Open terminal and execute pecl install zip
  2. Updating your php.ini:
  1. Linux: find your php.ini file and add "extension=zip.so"
  2. Windows: same as one, just add "extension=zip.dll
  • Restart httpd\apache 
    1. service httpd restart
    2. apache2ctl restart
    3. or any other way that you like

    Usage Example

    There are many different ways to use and build Zip helpers. I will just demonstrate an example for using ZipArchive. 

     Pastebin: http://pastebin.com/J2M0jjQG

     Inline... 

    20Nov/112

    Setup\Configure Zend Debugger

    Posted by Shaked

    Using a debugger is very important while writing code, so lets see how to do it with PHP and Zend Debugger: 

    1. Install Eclipse or Zend Studio 
    2. If you have installed Eclipse, you should install two more things:
      1.  PDT (PHP Development Tools)
      2. Zend Debugger
    3. After extracting everything, search for ZendDebugger.so path
    4. Edit your php.ini or create another ini --> zend.ini which will have to be loaded by your PHP and add:
       
      ; Loading Zend Debugger Extension
      zend_extension=/your/path/to/ZendDebugger.so
      ;
      ; use 127.0.0.1 for local host, or you another local network IP
      zend_debugger.allow_hosts=127.0.0.1
      ;
      ;
      Expose Zend Debugger
      ;
      ;
      never - do not expose (default)
      ;
      always - expose to whoever want to know
      ;
      allowed_hosts - expose only if request comes from an IP listed above
      ;
      zend_debugger.expost_remotely=always
      
    5. Save & Restart Apache
    6. Verify your phpinfo()
    7. Download FireFox or Chrome Extension (Chrome extension is not official extension by Zend) 
    8. Configure Eclipse \ Zend Studio settings:
    9. Configure your extension settings:
    10. Start debugging!:) 
    Helpful links: 
     

     

    Note for Zend Studio 8.x users:

    I suggest that you will update your Zend Studio application by using the following instructions: 

    http://forums.zend.com/viewtopic.php?f=59&t=10468

    Enjoy!

    Yuval Halfon liked this post
    6Oct/110

    Highlight your text and share short URL

    Posted by Shaked

    Today I wanted to share a text with my brother so I thought about making new tool that will highlight my text and create short URL. After some googling I have found a very nice tool that already implement it "Yellow highlighter pen for web". This plugin is working on Chrome and may be found athttp://www.marker.to or at Google chrome extension web store 

    Use it carefully ;)  

     

    Shak.