Kurinchi Blogger Scribbles …


Archive for the ‘PHP’ Category

Feb 27
2013

PEAR setup in WAMP in simple steps

Last updated: February 27th, 2013

* After WAMP is installed go to the folder where the web server related PHP bin directory is present. Search for the batch file pear.bat in it. Double click the file to start the PEAR installation. Go with the defaults and complete the installation

* Search for PEAR_ENV.reg. Double click that file to register the PEAR settings as environment variable

* Go to the command prompt and type “pear list” to see what packages are installed and if PEAR is correctly installed. If PEAR cannot be accessed via the command line, it means the PATH setting is not set correctly. Environment PATH variable should include the path to where pear.bat is present

Feb 01
2013

How to install PHPSECLIB on a WAMP environment with PEAR setup?

Last updated: March 1st, 2013

PEAR should be already installed in the system before configuring the phpseclib channel.

PHPSecLib installation is very simple.

PHPSecLib is a library of optional PHP extensions which comes in handy if the application were to be packaged as a solution for deployment to the end user.

Step 1: Register the channel

c:\> pear channel-discover phpseclib.sourceforge.net
(more…)

Sep 01
2012

How to integrate Zend Framework with WordPress blog or Joomla website?

Last updated: September 1st, 2012

Follow the simple steps given below to integrate Zend framework with other applications like WordPress, Joomla and other such open source or custom web applications.

i) Setup your Zend framework application as usual.

ii) Set the document root of the Zend application to the public folder within Zend install

iii) Now setup a folder for your wordpress or joomla or custom application. Let us assume that we want to create a custom blog application. Create a folder “blog” within “public” folder. Inside blog folder, create two files – .htaccess and index.php. Code for the two files are given below
(more…)

Aug 28
2012

How to debug PHP programs with XDebug and Notepad++?

Last updated: August 28th, 2012

XDebug provides a lot of useful information to a PHP programmer to debug code thus saving time and increasing efficiency.

As a first step, check the version of PHP you are running by creating phpinfo() in a file.

When the program is executed you will see a line of text showing the version of PHP you are using


This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Now that we know the version of PHP we are using, we can download the relevant xdebug version to to debug PHP programs with Notepad++

We will setup Notepad++ with xdebug and dbgp plugin.
(more…)

Aug 12
2012

RFC 3339 date format in RSS Feeds

Last updated: August 13th, 2012

RSS Feeds use RFC 3339 date format in their XML/Atom feeds.

Date formats have often caused confusion in the development, interoperability and maintenance of software applications. To improve the consistency in use of Date and Time, RFC 3339 came into existence which uses Coordinated Universal Time (UTC).

For PHP versions < 5.2,


$dateRFC = "2008-12-01T13:30:00.000-04:00";
$myDate = date('d.m.Y', strtotime($dateRFC)); // 01.12.2008

For PHP versions >= 5.2,


$dateRFC = "2008-12-01T13:30:00.000-04:00";
$myDate = new DateTime($dateRFC);
$dateStr = date('d.m.Y', strtotime($dateRFC)); // 01.12.2008

Read: IETF: RFC 3339

Nov 15
2011

Linux: How to upgrade PHP from 5.1 to 5.2 in CentOS5?

Last updated: November 15th, 2011

First Check PHP version that is currently installed

$ php -version

Check Linux Version

$ cat /etc/*-release (or redhat-release)

Create a repo file with the content given below. As you can note, we are looking for package upgrade related to php only.
(more…)

Mar 06
2011

Zend Framework: Simple steps to create Action Helper

Last updated: August 21st, 2011

Action helpers in Zend controller helps in abstracting concepts that are in common use for the project without cluttering the code base.

Zend’s official website and Zend casts gives detailed easy to use examples.

Step 1: Decide where you want the helper class for the controllers to reside inside the application folder. For this example, let us create a folder hierarchy under “application” folder

» application/controllers/Helper
(more…)

Jan 26
2011

PHP Excel reader

Last updated: January 26th, 2011

php-excel-reader Parse and retrieve information from XLS files

Download from Code Google

When the excel reader is run on PHP 5.3, below mentioned deprecated warning messages gets shown.

i) Assigning the return value of new by reference is deprecated

Remove & from the line below

$this->_ole =& new OLERead();

and have

$this->_ole = new OLERead();

instead.

ii) Function split() is deprecated

Function split() is deprecated and we can use explode() instead of that.

$parts = split(“;”,$format);

change it to

$parts = explode(“;”,$format);

Oct 29
2010

How to configure Zend Framework in windows?

Last updated: May 29th, 2011

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 zf.sh) 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

Aug 02
2010

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

Last updated: December 30th, 2010

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
ini_set(“memory_limit”,”20M”);

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


Valid HTML 4.01 Strict  Valid HTML 4.01 Strict