Posts Mentioning RSS Toggle Comment Threads | Keyboard Shortcuts

  • Shiki 7:59 pm on March 30, 2010 Permalink | Reply
    Tags: firebug, firephp, log, , yii   

    FirePHP Logger for Yii Framework 

    I made this a few weeks ago. It is a Yii Framework extension which routes log messages to FirePHP.

    Requirements

    Installation

    1. Download and extract the “shiki” folder to your extensions directory. This is usually “/protected/extensions”.
    2. Download the FirePHP core class and put it somewhere in your “/protected” directory. I usually put these files in /protected/vendors.
    3. Modify your config file to include this LogRoute class and set the “fbPath” property to the path of fb.php. Use a Yii alias (i.e. application.vendors.FirePHPCore031.lib.FirePHPCore.fb):
    config file code (i.e. /protected/config/main.php)
    ....

    'log'=>array(
        'class'=>'CLogRouter',
        'routes'=>array(
            // the default (file logger)
            array(
                'class'=>'CFileLogRoute',
                'levels'=>'error, warning',
            ),
            // the FirePHP LogRoute
            array(
                'class' => 'ext.shiki.firePHPLogRoute.ShikiFirePHPLogRoute', // "ext" alias points to /protected/extensions
                'fbPath' => 'application.vendors.FirePHPCore031.lib.FirePHPCore.fb', // set path to fb.php
            ),
        ),
    ),

    ....

    Usage

    Once you’ve got the extension setup in the config, you can use Yii’s logging methods to log messages to FirePHP.

    // logging an INFO message (arrays will work and looks awesome in FirePHP)
    Yii::log(array('username' => 'Shiki', 'profiles' => array('twidl', 'twitter', 'facebook')), CLogger::LEVEL_INFO);

    // logging a WARNING message
    Yii::log("You didn't setup a profile, are you really a person?", CLogger::LEVEL_WARNING);

    // logging with a CATEGORY (categories are displayed as "labels" in FirePHP -- just an additional info text)
    Yii::log('Profile successfully created', CLogger::LEVEL_INFO, 'application.user.profiles');

    // tracing simple text
    Yii::trace('Loading application.user.profiles.ninja', 'application.user.profiles');

    // logging an ERROR
    Yii::log('We have successfully determined that you are not a person', CLogger::LEVEL_ERROR, 'Any category/label will work');
     
  • Shiki 2:23 pm on March 15, 2010 Permalink | Reply
    Tags: memcached, , , windows   

    Installing Memcached for PHP 5.3 on Windows 7 

    First off, all credits go to this guy. I’m just listing the steps on how I did it in Windows 7 with PHP 5.3. Also, I tested this using WampServer but I believe it should work on any PHP install.

    Install memcached

    1. Download the Memcached Win32 library here: http://code.jellycan.com/memcached/. Extract the downloaded archive file in a directory (i.e. c:\memcached). There should be a memcached.exe in there.
    2. Run a command prompt as an administrator. Some info on how to do that here.
    3. Install memcached as a service. Go to the memcached directory, type and run:
      memcached -d install
    4. Start the memcached service by running:
      memcached -d start

    Install PHP Memcache extension (php_memcache.dll)

    1. Chances are you don’t have php_memcache.dll in your PHP extensions yet. You can download a build of it here. Make sure to download the correct one for your system. Mine was 32bit and PHP 5.3 so I used this: php_memcache-cvs-20090703-5.3-VC6-x86.zip. The archive should contain php_memcache.dll. Extract the archive to your php extensions directory. On my system (WampServer), this was C:\wamp\bin\php\php5.3.0\ext.
    2. Edit php.ini, add this line to enable the extension:
      extension=php_memcache.dll

      This is a little easier for WampServer users because there’s a menu for enabling extensions ^_^x

    Test

    Test the installation using the sample PHP code here: http://www.php.net/manual/en/memcache.examples-overview.php

     
    • orlando 7:27 pm on March 28, 2010 Permalink

      this is sucks, the php client library is not memcacheD its just ‘memcache’ (without D), if any of you find this fucking D please let me know.

    • Shiki 7:49 pm on March 29, 2010 Permalink

      @orlando Thanks for pointing that out. Sorry I always get confused by that D.

    • paul 3:55 pm on April 30, 2010 Permalink

      Tnx man, you saved my life :D

    • Dominic Watson 6:00 pm on May 12, 2010 Permalink

      how are we supposed to let you know? you didn’t provide contact details ^^

      Thanks for this article

    • Ronen 1:37 am on July 5, 2010 Permalink

      Great helpful work Shiki! worked great for me.
      Thanks.

  • Shiki 11:47 pm on August 31, 2009 Permalink | Reply
    Tags: eclipse, proxy, putty, remote-editing, ssh, tunnel, zend-studio   

    Zend Studio (Eclipse) Remote Editing through a secure proxy 

    Remote Editing in Zend Studio for Eclipse has to be one of the biggest reasons why I use it in my current job. I work from home and our team’s development environment is securely setup on a Linux server with a firewall open only to specific IP addresses. This is a no biggie if my IP address never changes or if I work only in one place. Unfortunately, that’s not the case for my DSL setup — I get a different IP address everyday. And since I can’t bug the server admin every time I need to have my IP address added to the firewall, I connect through our proxy server first and then connect to the main development server. The setup’s kinda like this:

    Local Machine to Proxy Server to Development Server setup

    The problem now is Zend Studio doesn’t seem to support this kind of setup. At least, that’s what I concluded after so many hours of googling. Then I found this super awesome article. We can use Putty! Or just plain ol’ Terminal on a Mac (Linux should be the same I think). (More …)

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
esc
cancel