Kurinchi Blogger Scribbles …

Archive for the ‘PHP’ Category

Jul 22

PHP Fatal error: Class ‘DOMDocument’ not found

Last updated: July 22nd, 2014

When setting up applications such as Magento you may come across the error message “PHP Fatal error: Class ‘DOMDocument’ not found …” in your apache server log files

Reason for the error is missing log files. Issue the commands below to fix the issue

$ yum -y install php-xml php-devel

$ service httpd reload

Jul 09

How to setup, install Apache, PHP and MySQL on Mac OS?

Last updated: July 9th, 2013

Apache server is installed by default on Mac. Access the configuration settings for Apache by going to

$ cd /etc/apache2/
$ vi httpd.conf

To enable php, edit httpd.conf and uncomment the line
#LoadModule php5_module libexec/apache2/libphp5.so

Uncomment other lines that you may want to load in your system. As you are enabling PHP in your system, you may want to change the DirectoryIndex to
DirectoryIndex index.php index.html

Default group/user settings inside Apache on Mac is _www:_www

Feb 27

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

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

Sep 01

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

Aug 28

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.

Aug 12

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

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.

Mar 06

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

Jan 26

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();


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);

Valid HTML 4.01 Strict  Valid HTML 4.01 Strict