How we configure memcached on fedora with machine restart

First install the memcached on server- linux box
# yum install php-pdo php-mcrypt squirrelmail php-pecl-apc php-xml php-gd php-devel php php-imap php-pgsql php-pear php-soap php-mbstring php-ldap php-mysql php-cli php-pecl-memcache

Using this file you can change the cache and memory size.
[root@purabk-pc purab]# vim /etc/rc.d/init.d/memcached

Aslo change the following file also. Do same setting in this file
# /etc/sysconfig/memcached

[root@purabk-pc purab]# /etc/init.d/memcached restart
Stopping memcached: [ OK ]
Starting memcached: [ OK ]

Following command will set command as wheneven machine reboots, memcached server will restart.

[root@purabk-pc purab]# /sbin/chkconfig memcached on


Run Php code in html files.

Just use following code in your .htaccess file or apache configration file.

AddType application/x-httpd-php .html

Or for .htm

AddType application/x-httpd-php .htm

I found following article useful.

solved – bash: phpize: command not found

This error is due to “phpize” command not available on your server.

To fix, install php-devel package.

If your server have yum (Eg: Fedora)

[root@localhost purab]# phpize
bash: phpize: command not found
[root@localhost purab]# yum -y install php-devel

[root@localhost purab]# phpize
Cannot find config.m4.
Make sure that you run ‘/usr/bin/phpize’ in the top level source directory of the module

[root@localhost purab]#
How to install the eaccelerator on fedora9?
use follwoing command

[root@localhost purab]# yum install php-eaccelerator

how to check the program’s installation path in linux/fedora

Use following commands:
[root@localhost ]# which php
[root@localhost ]# which ruby
[root@localhost ]# php –version
PHP 5.2.9 (cli) (built: Apr 17 2009 03:42:25)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
[root@localhost ]# ruby –version
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]
[root@localhost Desktop]#

Create XML through php and mysql

Here I am giving you the very basic sample code for creating the XML file through PHP and MYsql


// We'll be outputting a PDF
header('Content-type: text/xml');

echo "”

$db_name = “testDB”;
$connection = mysql_connect(“”, “username”, “password”) or die(“Could not connect.”);
$table_name = ‘user’;

$query = “select * from ” . $table_name;

$result = mysql_query($query, $connection) or die(“Could not complete database query”);
$num = mysql_num_rows($result);

while ($row = mysql_fetch_assoc($result)) {
echo “”. $row[‘firstname’].””;
echo “”. $row[‘lastname’].””;
echo “

“. $row[‘address’].”

echo “”. $row[‘age’].””;