How to configure Zend Framework in windows?

Steps to configure Zend Framework in windows

i) Check if the path to PHP executable is set. You can check this by executing php -version from command prompt.

ii) Move zf.bat (or and zf.php which will be present in the Zend Framework’s bin folder to the php’s bin folder (where php.ini resides)

iii) Move \path\to\znedframework\library to the location identified by “include_path” variable

One way to identify the include_path variable
-> php -i

Other way is to open the php.ini file to identify the location. You can also append the path to zend framework’s library to the include path variable within php.ini file.

For Windows users, you can add an environment variable (system variable) that would point to the Zend Framework’s library folder and name the variable “ZEND_TOOL_INCLUDE_PATH”

If the configuration has been done correctly then you should be able to get a positive response when you execute

-> zf show version
-> zf –help


PHP: ‘Fatal error: Allowed memory size of 8388608 bytes exhausted’

Reason why you see this message is due to PHP memory leakage. PHP is trying to load a large image or file into memory and is not finding enough space for it to load.

If you think, that you will need the necessary feature to upload large files then there are two ways by which you can enable this feature.

i) Edit the physical file and have the line

ii) Edit php.ini and add the following line. You need to restart the apache/IIS server once php.ini file is modified.


Zend’s Directory Structure

Some factors like host environment setup, multiple projects for single/multiple clients, common helpers, cross-functionality between sites etc. determines how the folder architecture needs to be structured. Zend framework offers this flexibility.
Continue Reading…


Setting up Zend Framework – for Beginners

Download the latest version of Zend framework from

At the time of writing it was 1.10.2 available at Zend 1.10.2

$ pwd

$ wget
Continue Reading…


UTF and Byte Order Mark (BOM)

UTF abbr. Unicode Transformation Format is a super set of characters that facilitates the display of characters from ALL languages that is currently in use.

BOM stands for Byte Order Mark (also known as ZERO WIDTH NON-BREAKING SPACE) appearing at the beginning of a data stream to define the byte order (whether it is little endian or big endian). BOM is to indicate that the file is Unicode based.

Possible problem caused by Byte Order Mark
In IE6, it will send the dispaly into quirks mode with its presence before “<DOCTYPE …”

How to check the presence of BOM?
View the source code of the page that does not display correctly in a user agent. Or, open the file in the editor which does not support UTF encoding to see the BOM’s signature on the files.

If the user-agent gives problem when you program for multi-lingual websites, check the editor settings to see what format is being used for saving program files. Notepad++ has the option to convert files to UTF and to UTF without BOM. Use the appropriate settings to convert your files.

A character set related tutorial on W3C site can be found here

Byte Order Mark on Wiki

Article on PHP and UTF


How to include PEAR libraries with CakePHP?

Suggested solutions from other sites:
1) Modify /config/paths.php
2) Create separate php.ini settings file with the path to PEAR library
3) Modify the app_controller.php with the PEAR path settings

My preference is to add the PEAR library to the “vendors” folder and to modify the app_controller to have the PEAR path included through it.

if( file_exists(VENDORS.’Pear’)){
ini_set(‘include_path’, ini_get(‘include_path’) . PATH_SEPARATOR . PEAR);

Above solution suggested at CakePHP’s trac

Depending on the library that you want to get included in the programs, add the library to the respective view

App::import(‘vendor’, ‘XML_Feed_Parser’, array(‘file’ => ‘../vendors/pear/XML/Feed/Parser.php’));


PHP: What is PEAR?

PEAR stands for PHP Extension and Application Repository.

To learn more about the PEAR library click here

If you are beginner, the following link will help you tread with the library usage PEAR Manual

Installation instructions clearly walks through the steps for PEAR configuration. There may be cases where you may want to use PEAR libraries for specific projects only in which case you can install PEAR library for that specific purpose. To use it in projects, PEAR path should be set in php.ini settings or should be included in the project configuration’s physical path.


PHP: Parse URL encoded GET data

// To build back the URI and to extract the passed parameters, you can use parse_url, parse_string function 
$extract_string = parse_url($pass_string);
echo "<h2>Extracted URI (using parse_url)</h2><br />";
echo "<pre>";
echo "</pre>";

// To decode the query string use parse_str function 
parse_str($extract_string["query"], $extract_query);
echo "<h2>Extracted Query String (using parse_str)</h2><br />";
echo "<pre>";
echo "</pre>"; 


PHP: Program to pass data using character encoding (GET Parameter)

PHP program to pass data as GET parameters

// PHP 5 how to pass data as a query string
http_build_query is a function in PHP 5 that enables you to URL encode the query string. You can pass an array or an array of array to this function. The default separator is "&"

$data = array("first_name" => "Robert",
                "last_name" => "Brown",
                "address" => "123 Adam St., New York"

// URI formatted with character encoding
$pass_string = "http://localhost/demo.php?".http_build_query($data, '');

echo "<h2>Query URI (using http_build_query)</h2><br />";
echo $pass_string;            

Ouput from the above execution:
Query URI (using http_build_query)


PHP: How to receive the posted XML data?

Receive the posted XML data

In order to test the posted data, we can create a file creation steps to ensure that we receive the posted data via the $_POST array

  File name: postdata2.php
    $xmlFile = "xmlFile.txt";
    $fh = fopen($xmlFile, 'w') or die("Cannot open file");
    fwrite($fh, $_POST["xmldata"]);

Kurinchi Calendar
September 2018
« Oct