..a dose of zero-day know-hows ..

5/03/2010

Using PHPXref

PHPXref is a PHP cross referencing documentation generator designed to make it easier for developers to browse a PHP application's codebase. With features such as mouse-over information and hot-jumping among classes and functions and extraction of phpdoc style documentation, it really does simplify a job of a developer in getting to know a new application.

It requires Perl to be installed since it uses a perl-based script to parse the source directory to generate a documentation. You may download the right version of Perl for your platform here.

Using PHPXref to generate a cross referencing documentation of any application is easy, assuming you already have Perl installed, just follow these 5 simple steps.

Step 1.) Download PHPXref from http://phpxref.sourceforge.net/#download (choose the version suited for your platform).

wget http://prdownloads.sourceforge.net/phpxref/phpxref-0.7.tar.gz?download

Step 2.) Uncompress the downloaded phpxref archive

tar xvpf phpxref-0.7.tar.gz

Step 3.) Navigate to the extracted folder and edit the file named phpxref.cfg. Edit the values for the SOURCE, OUTPUT and PROJECT as needed.


(NOTE: You may need to create the directory for the OUTPUT if it doesn't exist yet to prevent runtime errors during generation as the phpxref script will not create it for you.)

Step 4.) Run the phpxref generation script by invoking the following command:

./phpxref.pl



Step 5.) Once generated, you may now browse the generated documentation in HTML format. If you have set the OUTPUT to point within your Document Root as with our example above, you may browse it using http://localhost/phpxref_sugarcrm or directly in its location since the generated doc is static.



You may automate this process to keep the cross referencing documentation up to date by regularly running phpxref.pl via cron.

5/02/2010

Quick Install Memcached and Memcache for PHP on Fedora

Memcached is a high-performance, distributed memory object caching system. In web applications implementation, it is intended to alleviate database load by caching the most requested data for faster retrieval and lessen DB hits.

Installing Memcached on Fedora and adding it as a PHP module is fairly simple using the console.

Step 1: Install Memcached

yum install memcached

Step 2: Install Memcache PECL module for PHP

yum install php-pecl-memcache

Step 3: Restart Apache

service httpd restart

Step 4: Run the Memcached Daemon

service memcached start

Once finished, you should be able to access memcache-related functions and utilities. You can check the memcache entry in the phpinfo() page which verifies that it has been successfully installed as PHP module.



For more information on how to use the Memcache Class provided by the Memcache PECL module, visit the following link: http://www.php.net/manual/en/book.memcache.php


2010 reset!

Its been awhile since I updated this blog, and there are a few broken links here and there which I will be fixing soon (Sorry). I'll probably add a few more tutorials within the month as soon as I find the time.

I am currently playing around Sphinx and will be posting quick start tutorials about it soon. I also wrote a simple quick-slapped hash-type agnostic reset-password implementation which I will be reviewing for posting (for newbies).

Check back again later. :) //Out