How to fix GPG or KEYEXPIRED error in ubuntu

If you have been using ibus-avro for a while, you may have encourtered this error when running apt-get update.

W: GPG error: ./ Release: The following signatures were invalid: KEYEXPIRED 1366357218

Lets see how to fix that.

  1. Open Ubuntu Software Center.
  2. From Top bar goto Edit > Software Sources
  3. Goto Authentication Tab and select the sarimkhan OBS Project key.
  4. Press Remove and confirm by entering your password.
  5. Now open up terminal and add the correcponding key for your OS, for example ubuntu 13.04
  6.  wget -q -O- | sudo apt-key add -
  7. Now you can update your software sources without any problem.
  8.  sudo apt-get update
  9. Have Fun and keep rocking.

If the command are not doing it for you, you have to do it on your own. After a long research on this problem i finally decided that the best thing to do was manually download the key and add it.This is how i did it. Go to Ubuntu Key-server(Click here). Here you can search your key. In my case it was 6AF0E1940624A220. Note while searching for key pre-append the key with 0x. So search for 0x6AF0E1940624A220

Click on the link provided in the pub section. Copy the whole text(highlighted in below screen shot) from the page and save it in a file(say filename is key1)

Once you have copied the data to file. Save it. Then run the following command

 sudo apt-key add key1

You will get an “OK” response.

And you are done. Repeat the procedure of other keys that might be missing. Then you can run sudo

apt-get update

and you will not get any error. Update happens smoothly. Do let me know if you still have any doubts.

WordPress Custom Post

WordPress has been gaining a foothold in the general content management system (CMS) game for a few years now, but the real breakthrough was the custom post type mechanism which allows for the creation of a wide variety of content in WordPress. In this plugin Custom Post For WordPress you can easily created your custom post like audio,video and portfolio…etc

==== Installation ====

  • Download Custom Post For WordPress.
  • Upload the Custom Post For WordPress directory to your /wp-content/plugins/ directory, using your favorite method (ftp, sftp, scp, etc…)
  • Activate Custom Post For WordPress from your Plugins page. (You’ll show “WPCustomPost” Menu in your admin sidebar.)
  • Then add new for WPCustomPost
  • After post has been created successfully then add new (post or page), then simply add shortcode [khan] in your post or page, You’ll show your all custompost 🙂

see more here

How to install Laravel 5 with Virtual Host configurations

I am sharing steps below with terminal command run screenshots that how to install laravel5 with Virtual Hosts configurations. we need to install composer to download laravel from remote server. for this first command will be for download composer using curl then second one move composer to local user directory for make composer globally use .

# installing composer
curl -sS | php
# move composer globally
sudo mv composer.phar /usr/local/bin/composer
# check composer working


Now we’ve composer installed successfully!!. and then there are two method to install laravel
1. Via Laravel Installer
2. Via composer

1. Via Laravel Installer :

laravel installer is a new method to install added for laravel 5. it’s much faster method than installing via Composer.

# Download installer

Rasel Khan:~$ composer global require "laravel/installer=~1.1"
Changed current directory to /home/khan/.composer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files

#Setting up path

Rasel Khan:~$ export PATH="~/.composer/vendor/bin:$PATH"

# If you’ve successfully configure then command type ‘laravel’ , you’ll see your laravel installer version 1.2.1

Rasel Khan:~$ laravel
Laravel Installer version 1.2.1

  command [options] [arguments]

  -h, --help            Display this help message
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi            Force ANSI output
      --no-ansi         Disable ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Available commands:
  help  Displays help for a command
  list  Lists commands
  new   Create a new Laravel application.

#Change dir where to install

Rasel Khan:~$ cd /var/www/project/

# Download and installing

Rasel Khan:~$ laravel new laravel5

# giving permission

Rasel Khan:~$ sudo chmod -R 777 laravel5

2. Via Composer :-

After install composer you can directly install laravel by create-project command and give your destination path where you want to install laravel.

# checking composer is successfully installed

Rasel Khan:~$ composer

# Create a ditectory where to install

Rasel Khan:~$ sudo mkdir /var/www/project/laravel5
[sudo] password for khan: 

# downloading and install via composer

Rasel Khan:~$ sudo composer create-project laravel/laravel /var/www/project/laravel5

# setting up writable permission

Rasel Khan:~$ sudo chmod -R 777 /var/www/project/laravel5

Another way you can do manually download and install

Now, let’s go configure with Virtual Hosts, create a config file into /etc/apache2/sites-available/ directory, i’ve create this file name called, another way you’ll use Vagrant environments

Rasel Khan:~$ sudo mkdir /etc/apache2/sites-available/

# now open file using any editor, I’m using nano editor .

Rasel Khan:~$ sudo nano /etc/apache2/sites-available/

# past below this code into file and save .

<VirtualHost *:80>
    DocumentRoot "/var/www/project/laravel5/public/"
    DirectoryIndex index.php
    <Directory /var/www/project/laravel5/public/>
        AllowOverride All

# Enable this file

Rasel Khan:~$ sudo a2ensite

# Reload apache server

Rasel Khan:~$ sudo service apache2 reload

# go to hosts file

Rasel Khan:~$ sudo nano /etc/hosts

# create a new one       localhost       raselkhan

# If you’ve all configuration is ok then need to restart your server

Rasel Khan:~$  sudo service apache2 restart

# now go any browser addressbar url and type

you’ll see laravel5 successfully install and configuration with virtual hosts.


Enjoy 🙂

Key Generation in Python

I’m creating a REST API for my current Django project, and I want a good psuedo-random way to generate alpha numeric API keys. Outlined is a simple method which I believe makes pretty good psuedo-random keys.

Like Session keys, API keys should be sufficiently unpredictable to be psuedo-random. To be unpredictable, no user variables (or timestamps) are encoded into the key.

Specifically, the key starts life as a 256bit number generated by the Mersenne Twister Pseudo Random Number Generator (PRNG).

>> str(random.getrandbits(256))

Mersenne Twister itself is not considered cryptographically secure (it has been demonstrated that observing a sufficient number of iterates allows one to predict all future iterates).

To mitigate this problem, the 256bit number is cryptographically hashed using SHA-256.

>> hashlib.sha224( str(random.getrandbits(256)) ).hexdigest()
>> 654c6da8f3b0fd8fe819669daf07996738d21a53c02c731b0aee6373

The result is then Base64 encoded – which results in a string containing only lower and upper case alphabetical characters, and numbers – and also two special characters (usually ‘/’ and ‘+’).

A character-pair (eg: ‘aF’ or ‘zZ’) is then selected randomly (pseudo-randomly) from a pool of character-pairs; these are substituted (salted) for the non-alphanumeric characters left by the Base64 encoding.

The resulting string is a 38 character alphanumeric that is sufficiently large and unpredictable for an API key.

>> base64.b64encode(hashlib.sha256( str(random.getrandbits(256)) ).digest(), random.choice([‘rA’,’aZ’,’gQ’,’hH’,’hG’,’aR’,’DD’])).rstrip(‘==’)
>> mwkMqTWFnK0LzJHyfkeBGoS2hr2KG7WhHqSGX0SbDJ4

Fix phpmyadmin on Ubuntu

Your LAMP server not work with phpmyadmin? let’s go fix this problem, before you’ve LAMP server install, if still not install LAMP you can simply install via command

$ sudo apt-get install lamp-server^

What do you mean LAMP ?

LAMP stack is a group of open source software used to get web servers up and running. The acronym stands for Linux, Apache, MySQL, and PHP. Since the virtual private server is already running Debian, the linux part is taken care of. Here is how to install the rest.

when you type address in browser


it show “Page not found”

Now see your “apache2.conf” file

Rasel Khan:~$ cat /etc/apache2/apache2.conf
# This is the main Apache server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See for detailed information about
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
# hints.
# Summary of how the Apache 2 configuration works in Debian:
# The Apache 2 web server configuration in Debian is quite different to
# upstream's suggested way to configure the web server. This is because Debian's
# default Apache2 installation attempts to make adding and removing modules,
# virtual hosts, and extra configuration directives as flexible as possible, in
# order to make automating the changes and administering the server as easy as
# possible.

# It is split into several files forming the configuration hierarchy outlined
# below, all located in the /etc/apache2/ directory:
#	/etc/apache2/
#	|-- apache2.conf
#	|	`--  ports.conf
#	|-- mods-enabled
#	|	|-- *.load
#	|	`-- *.conf
#	|-- conf-enabled
#	|	`-- *.conf
# 	`-- sites-enabled
#	 	`-- *.conf
# * apache2.conf is the main configuration file (this file). It puts the pieces
#   together by including all remaining configuration files when starting up the
#   web server.
# * ports.conf is always included from the main configuration file. It is
#   supposed to determine listening ports for incoming connections which can be
#   customized anytime.
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
#   directories contain particular configuration snippets which manage modules,
#   global configuration fragments, or virtual host configurations,
#   respectively.
#   They are activated by symlinking available configuration files from their
#   respective *-available/ counterparts. These should be managed by using our
#   helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
#   their respective man pages for detailed information.
# * The binary is called apache2. Due to the use of environment variables, in
#   the default configuration, apache2 needs to be started/stopped with
#   /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
#   work with the default configuration.

# Global configuration

# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
# NOTE!  If you intend to place this on an NFS (or otherwise network)
# mounted filesystem then please read the Mutex documentation (available
# at <URL:>);
# you will save yourself a lot of trouble.
# Do NOT add a slash at the end of the directory path.
#ServerRoot "/etc/apache2"

# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
Mutex file:${APACHE_LOCK_DIR} default

# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars

# Timeout: The number of seconds before receives and sends time out.
Timeout 300

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
MaxKeepAliveRequests 100

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
KeepAliveTimeout 5

# These need to be set in /etc/apache2/envvars

# HostnameLookups: Log the names of clients or just their IP addresses
# e.g., (on) or (off).
# The default is off because it'd be overall better for the net if people
# had to knowingly turn this feature on, since enabling it means that
# each client request will result in AT LEAST one lookup request to the
# nameserver.
HostnameLookups Off

# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here.  If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
ErrorLog ${APACHE_LOG_DIR}/error.log

# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf

# Include list of ports to listen on
Include ports.conf

# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
	Options FollowSymLinks
	AllowOverride None
	Require all denied

<Directory /usr/share>
	AllowOverride None
	Require all granted

<Directory /var/www/>
	Options Indexes FollowSymLinks
	AllowOverride None
	Require all granted

#<Directory /srv/>
#	Options Indexes FollowSymLinks
#	AllowOverride None
#	Require all granted

# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
AccessFileName .htaccess

# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
<FilesMatch "^.ht">
	Require all denied

# The following directives define some format nicknames for use with
# a CustomLog directive.
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

Include /etc/phpmyadmin/apache.conf

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

I’ve include this one line, see below at last on the top

Include /etc/phpmyadmin/apache.conf

If you’ve not include this line edit your “apache2.conf” file, I’m using nano editor for file include

Rasel Khan:~$ sudo nano /etc/apache2/apache2.conf

After include this line, you should restart your server

Rasel Khan:~$ sudo service apache2 restart

Now try


it’ll works fine !! 🙂

Fix Skype install problem on Ubuntu

Sometimes your Skype installation problem on Ubuntu, let’s go fix it

Step 1: Remove previous version.

sudo apt-get remove skype skype-bin:i386 skype:i386
sudo apt-get install sni-qt:i386

It is Important if you installed older version of Skype on your Ubuntu, Clear the old Skype folder before installing latest version. Then clear that by using:

rm -rf ~/.Skype

Step 2: Preparing to Installing Skype.

Users of 64-bit Ubuntu, should enable MultiArch if it isn’t already enabled by running the command

    sudo dpkg --add-architecture i386

Update repositories and “updates” list:

    sudo apt-get update

Optional, install GDebi (see below):

    sudo apt-get install gdebi #(read Why you need to install gdebi...)

Step 3: Installing Skype

Method 1: Download and install from file

sudo gdebi skype-ubuntu-precise_4.3.0.37-1_i386.deb

Method 2: Install Skype from Canonical Partner Repository

So add the Canonical Partner Repository to “updates” list by following the command:

sudo add-apt-repository "deb $(lsb_release -sc) partner"

Then install Skype via the Software-Center or via the Terminal.

sudo apt-get update && sudo apt-get install skype

Broadband connection set up in Ubuntu

If you’have installed Ubuntu 14.04 LTS alongside Windows Xp or Windows 7. Your broadband connection working ok in Windows Xp or 7, but sometimes it is not working in Ubuntu. Let’s go how can you solve this problem, Open your terminal and type ifconfig you’ll see all configuration in your network.

Rasel Khan:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr e0:69:95:12:b0:4c  
          inet addr:  Bcast:  Mask:
          inet6 addr: fec0::b:751e:ae5e:9810:845d/64 Scope:Site
          inet6 addr: fe80::e269:95ff:fe12:b04c/64 Scope:Link
          inet6 addr: 2002:2d74:f8a1:b:e269:95ff:fe12:b04c/64 Scope:Global
          inet6 addr: 2002:2d74:f8a1:b:751e:ae5e:9810:845d/64 Scope:Global
          inet6 addr: fec0::b:e269:95ff:fe12:b04c/64 Scope:Site
          RX packets:36202 errors:0 dropped:1 overruns:0 frame:0
          TX packets:14115 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10454044 (10.4 MB)  TX bytes:2518480 (2.5 MB)
          Interrupt:20 Memory:fe400000-fe420000 

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:2182 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2182 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:115203 (115.2 KB)  TX bytes:115203 (115.2 KB)

Step-1: Open network connections by searching for it in the dash.

Now Click on the Add button.

Step-2: Choose the network type as DSL and then click create.

Step-3: Now type the username and password and save.

You can also choose to connect automatically in the general tab.

If still not working 🙁 , let’s go another way …

Step-1: Open your terminal simply type command sudo pppoeconf you’ll build step by step your network configuration !

Rasel Khan:~ sudo pppoeconf
[sudo] password for khan: 

Step-2: After type your valid password for sudo user then you’ll show for “dsl-provider” configuration..then type “” !

 If you continue with this program, the configuration file          │     
     │ /etc/ppp/peers/dsl-provider will be modified. Please make sure     │     
     │ that you have a backup copy before saying Yes.                     │     
     │                                                                    │     
     │ Continue with configuration?                                       │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                  <Yes>                     <No>        

Step-3: Change your network configuration settings via enter ““for configuration..

 Most people using popular dialup providers prefer the options      │     
     │ 'noauth' and 'defaultroute' in their configuration and remove the  │     
     │ 'nodetach' option. Should I check your configuration file and      │     
     │ change these settings where neccessary?                            │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                                                                    │     
     │                  <Yes>                     <No>     

Step-4: Enter your valid internet(Broadband) connection username (i.e my username “khancse” ) , then “” for continue.. ..

┌────────────────────┤ ENTER USERNAME ├────────────────────┐          
          │ Please enter the username which you usually need for the │          
          │ PPP login to your provider in the input box below. If    │          
          │ you wish to see the help screen, delete the username and │          
          │ press OK.                                                │          
          │                                                          │          
          │ username___khancse_____________________________________________ │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                          <Ok> 

Step-5: Enter your valid internet(Broadband) connection password, then Ok for continue.. .. .

┌────────────────────┤ ENTER PASSWORD ├────────────────────┐          
          │ Please enter the password which you usually need for the │          
          │ PPP login to your provider in the input box below.       │          
          │                                                          │          
          │ NOTE: you can see the password in plain text while       │          
          │ typing.                                                  │          
          │                                                          │          
          │ password________________________________________________ │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                          <Ok>     

Step-6: If you’ve entered valid information for username and password, then you’ll got
useable servers when the connection is established . Enter “” for configuration..

 USE PEER DNS ├─────────────────────┐          
          │                                                          │          
          │ You need at least one DNS IP address to resolve the      │          
          │ normal host names. Normally your provider sends you      │          
          │ addresses of useable servers when the connection is      │          
          │ established. Would you like to add these addresses       │          
          │ automatically to the list of nameservers in your local   │          
          │ /etc/resolv.conf file? (recommended)                     │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │               <Yes>                  <No>  

Step-7: Now need to byte allocation for pppoe clamp MSS, then “” for continue, (If you still get problems described above, try setting to number of byte in the dsl-provider file.)

LIMITED MSS PROBLEM ├───────────────────────┐     
     │                                                                    │     
     │ Many providers have routers that do not support TCP packets with a │     
     │ MSS higher than 1460. Usually, outgoing packets have this MSS when │     
     │ they go through one real Ethernet link with the default MTU size   │     
     │ (1500). Unfortunately, if you are forwarding packets from other    │     
     │ hosts (i.e. doing masquerading) the MSS may be increased depending │     
     │ on the packet size and the route to the client hosts, so your      │     
     │ client machines won't be able to connect to some sites. There is a │     
     │ solution: the maximum MSS can be limited by pppoe. You can find    │     
     │ more details about this issue in the pppoe documentation.          │     
     │                                                                    │     
     │ Should pppoe clamp MSS at 1452 bytes?                              │     
     │                                                                    │     
     │ If unsure, say yes.                                                │     
     │                                                                    │     
     │ (If you still get problems described above, try setting to 1412 in │     
     │ the dsl-provider file.)                                            │     
     │                                                                    │     
     │                  <Yes>                     <No>    

Step-8: Your PPPD is configured now, then “” for continue..

┤ DONE ├─────────────────────────┐          
          │                                                          │          
          │ Your PPPD is configured now. Would you like to start the │          
          │ connection at boot time?                                 │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │               <Yes>                  <No>                │          

Step-9: In this step ESTABLISH A CONNECTION with “dsl-provider”, then “” for continue…After complete all the steps you’ll got your connection !!

 ESTABLISH A CONNECTION ├────────────────┐          
          │                                                          │          
          │ Now, you can make a DSL connection with "pon             │          
          │ dsl-provider" and terminate it with "poff". Would you    │          
          │ like to start the connection now?                        │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │                                                          │          
          │               <Yes>                  <No>   

Check your “dsl-provider” file, you’ll show all configuration with your username, i’m using nano editor .

Rasel Khan:~ sudo nano /etc/ppp/peers/dsl-provider
[sudo] password for khan: 

# Minimalistic default options file for DSL/PPPoE connections

#lcp-echo-interval 30
#lcp-echo-failure 4
#mtu 1492
#maxfail 0
#holdoff 20
plugin eth0
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@user "khancse"
user "khancse"

The network applet shows device not managed, but my internet connection works fine.
Enjoy 🙂

Fix WordPress Feed XML Parsing Errors

When you try to Export all content or rss feed in wordpress then it’ll show XML Parsing Error and not working with seo in your site and so was the WordPress source feed which showed “XML Parsing Error: XML or text declaration not at start of entity“. And all this while Google reader was correctly tracking our feed, while it was not loading in any web browser!

XML Parsing Error
Firefox showed this error on loading the feed

XML Parsing Error: XML or text declaration not at start of entity Location: Line Number 2, Column 1: ^

Google Chrome revealed some more information

This page contains the following errors: error on line 2 at column 6: XML declaration allowed only at the start of the document Below is a rendering of the page up to the first error.

I found that it was most commonly caused by a Blank line before XML declaration

Basically this error arises if there is a whitespace before an XML declaration

<?xml ... ?>

appears in your feed. The blank line error means that the code has blank lines in it, which can be easily introduced in the WordPress php code by a plugin, theme, or any configuration file.

So basically I had to go looking for blank lines before PHP starting tag

and after the PHP closing tag

I intended to use the ‘Fix RSS Feed WordPress plugin’ which promised to search all folders (except wp-admin and wp-includes directory) if the php file has blank lines in the head and tail line, and then delete blank lines. The plugin author writes that it will delete php files at only the beginning and end of the blank lines, and will not delete the blank lines between documents, so it will not affect the operation of the php programs.

Now, change your root directory where wp-config.php include, see below

Rasel Khan:~$ cd /var/www/project/wordpress
Rasel Khan:~$ ls
index.php    wp-activate.php     wp-comments-post.php  wp-content   wp-links-opml.php  wp-mail.php      wp-trackback.php
license.txt  wp-admin            wp-config.php         wp-cron.php  wp-load.php        wp-settings.php  xmlrpc.php
readme.html  wp-blog-header.php  wp-config-sample.php  wp-includes  wp-login.php       wp-signup.php

open your ‘index.php’ file via any editor, I’m using gedit editor

Rasel Khan:~$ sudo gedit index.php

Here ‘index.php’ file look

 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 * @package WordPress

 * Tells WordPress to load the WordPress theme and output it.
 * @var bool
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

Now create a new file called ‘fix-rss.php’ in ‘wp-config.php’ directory and copy the follwing code

function wp_xml_fix_rss($input) {
	$allowed = false;

	$found = false;

	foreach (headers_list() as $header) {
		if (preg_match("/^content-type:s+(text/|application/((xhtml|atom|rss)+xml|xml))/i", $header)) {
			$allowed = true;

		if (preg_match("/^content-type:s+/i", $header)) {
			$found = true;

	if ($allowed || !$found) {
		return preg_replace("/As*/m", "", $input);
	} else {
		return $input;


Finally include ‘fix-rss.php’ file in ‘index.php’, see below look like

 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 * @package WordPress

 * Tells WordPress to load the WordPress theme and output it.
 * @var bool
include './fix-rss.php';
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require( dirname( __FILE__ ) . '/wp-blog-header.php' );

It’ll be works ! 🙂
if any problem just comment here………

পিএইচপি অ্যারে

পিএইচপি অ্যারে

  • একটা ভেরিয়েবল একটা single value এর পাত্র(container).কিন্তু অ্যারে একাধিক value’র container বা পাত্র।
  • একটা অ্যারে হল কিছু উপাদান নিয়ে গঠিত যেখানে প্রত্যেকটি উপাদানের নির্দিষ্ট value আছে-key বা index বলে যেটা দিয়ে উপাদানটিকে রেফার করা হয়।
  • ধরুন আপনার কাছে কিছু শহরের নামের লিস্ট আছে এখন যদি এগুলোকে কোনো single variable এ store করে রাখতে চান তাহলে এমন হবে-

    $city1= “Dhaka”
    $city2= “Chittagong”
    $city3= “Rajshahi”
    $city4= “Sylet”
    $city5= “Khulna”
    $city6= “Barishal”

  • কিন্তু একটা অ্যারে এসবগুলোকে একটা ভ্যারিয়েবল এ ধরে রাখতে পারে।
  • অ্যারের সাধারন গঠন পদ্ধতি হচ্ছে কিছু উপাদানের ক্রম (series of element) যার উপাদানগুলির index ০ থেকে শুরু হয়ে ক্রমানুসারে বাড়তে থাকবে।
  • বেশ কয়েকভাবে অ্যারে লেখা যায় সবচেয়ে সহজটি হচ্ছে-

    $city = array("Dhaka", "Chittagong", "Rajshahi","Sylet", "Khulna", "Barishal");

    ব্যাস একটা variable এ সব শহরের নাম store হয়ে গেছে,প্রতিটি শহরের নাম এক একটি উপাদান এবং প্রতিটি উপাদানে একটি index নির্দিষ্ট হয়ে গিয়েছে।
    array’র ১ম উপাদান এর index/key হচ্ছে ০ তাহলে এখানে Dhaka[0], Chittagong[1]… এভাবে বাকিগুলো।
    এখন আপনি যেকোন উপাদান এর index number উল্লেখ করে সে উপাদানটি পেতে পারেন।যেমন

    Print "$city[3]";

    তবে যদি আমরা চাই তাহলে অ্যারের এই ডিফল্ট ভ্যালু পরিবর্তন করে দিতে পারি,=> এই অপারেটরটি দিয়ে। ধরি আমি চাচ্ছি এই উপরের অ্যারেটির starting index 2 দিয়ে শুরু হোক তাহলে এভাবে লিখতে হবে

    $city=array(2=>"Dhaka", "Chittagong", "Rajshahi",
    "Sylet", "Khulna", "Barishal", "Barishal");

    এই অপারেটর যেকোন উপাদানের পূর্বে ব্যাবহৃত হতে পারে তার index নির্দিষ্ট করার জন্য।

    অ্যাসোসিয়েটিভ অ্যারে (Associative array)

    এতক্ষনতো পূর্ন সংখ্যার index/key দেখলাম আপনি চাইলে string ও ব্যাবহার করতে পারেন।এটাকেই associative array বলে।যেমন:

    $ages = array("adnan"=>32, "rezwan"=>30, "refat"=>34);

    মাল্টিডাইমেনশনাল অ্যারে (Multidimensional array)

    এখানে একটা অ্যারের ভিতর প্রতিটি উপাদান একটি অ্যারে হতে পারে আবার এই সব অ্যারের প্রতিটি উপাদানও একটি অ্যারে হতে পারে এবং এভাবে আরও।


    আরও মাল্টিডাইমেনশনাল অ্যারে (Multidimensional array others)

    foreach() লুপ

  • foreach লুপ শুধুমাত্র অ্যারে ম্যানিপুলেট করার জন্য তৈরী করা হয়েছে। তাই এই লুপিং সিস্টেম শুধুমাত্র অ্যারের উপরে কাজ করবে।
  • foreach লুপে as শব্দের পরে যে ভেরিয়েবল থাকে (আপনার ইচ্ছেমত এই ভেরিয়েবলের নাম দিতে পারেন) সেই ভেরিয়েবলে অ্যারের এলিমেন্টগুলি একটা একটা করে আসবে।
  • অন্যান্য লুপিং এ আমরা ঠিক করে দেই যে লুপিং কত থেকে শুরু হবে এবং কত পর্যন্ত চলবে।
  • আর এখানে অ্যারের প্রথম এলিমেন্ট থেকে লুপিং শুরু হবে এবং অ্যারের শেষ এলিমেন্ট আসলে তখন লুপিং শেষ হবে।
  • <?php
    $city=array("Dhaka", "Chittagong", "Rajshahi",
    "Sylet","Khulna", "Barishal", "Barishal");
    foreach ($city as $value)
    echo "$value.<br>";



    range() ফাংশন দিয়ে অ্যারে তৈরী করা যায়।যেমন

    $numeric1 = range(10,15);
    //This is similar to
    $numeric1 = array(10,11,12,13,14,15);
    //array with optional parameter (even array)
    $numeric2 = range(10,20,2);
    //This is similar to
    $numeric2 = array(10,12,14,16,18,20);
    //array odd
    $numeric3 = range(11,21,2);
    //This is similar to
    $numeric3 = array(11,13,15,17,19,21);
    //letter array
    $letter = range("C","K");
    //This is similar to
    $letter = array("C","D","E","F","G","H","I","J","K");

    এভাবে range() ফাংশন দিয়ে অ্যারে লেখার সুবিধা হচ্ছে বড় অ্যারেকে কত ছোট করে লেখা যাচ্ছে কিন্তু কাজ একই অ্যারে চেক করা।

    is_array() ফাংশন দ্বারা একটা ভেরিয়েবল অ্যারে কিনা তা চেক করা যায়।যেমন

    //letter array
    $letter = range("C","K");
     echo "this is an array and its 3rd value is $letter[2]";
     echo "this is not an array";


    this is an array and its 3rd value is E

    অ্যারে উঠিয়ে দিয়ে কোন স্ট্রিং বা অন্যকিছু বসিয়ে দেখুন আউটপুট আসবে

    this is not an array

    print_r() দিয়ে অ্যারের সব কনটেন্ট দেখা কোড ডিবাগিং এর সময় এটা কাজে লাগে। ধরুন উপরের letter অ্যারেটির সব কনটেন্ট দেখতে চান তাহলে



    Array ( [0] => C [1] => D [2] => E [3] => F [4] => G [5] => H [6] => K )

    পিএইচপি লুপঃ While লুপ, ফর লুপ

    আসলে এককাজ বারবার করতে আমাদের সকলেরই খারাপ লাগে যেমন একই সিল ৫০টা ইনভেলপ এর মধ্যে মারা বা ধরুন একই কথা ১০০টা পেজের মধ্যে লেখা ইত্যাদি।প্রোগ্রামিং এ মজার ব্যাপারটা হচ্ছে একটু চিন্তা করলেই এইসব পূনরাবৃত্তির কাজ কয়েক লাইন লিখেই করা যায়।লুপ দিয়ে এগুলো করা যায়।

    লুপ হচ্ছে এমন একটা statement যেটা দিয়ে একটা কোডের ব্লক কে নির্দিষ্ট কয়েকবার execute করা যায় যতক্ষন না আমাদের কাজটা শেষ হয়।

    ৪ ধরনের লুপ আছে-

  • While Loop
  • Do…while Loop
  • For Loop
  • Foreach Loop
  • পিএইচপি While লুপ

    যখন একটা condition true হয় তখন while লুপ টি একটা কোড ব্লক কে execute করে।


    while (condition)
    code to be executed;

    যদি condition false হয় তখন ব্রাকেটের ভিতর কোডটি এড়িয়ে যায়।যখন শেষের ব্রাকেটটি আসবে তখন condition আবার চেক করবে,true হলে কোড আবার execute করবে।condition এ যতবার দেয়া আছে ততবার এভাবে চলবেই।যেমন:

    echo "The number is " . $i . "<br />";

    প্রথমে i=1. এরপর while($i<=5) অর্থ্যাৎ লুপটি ততক্ষন চলবে যতক্ষন I এর মান ৫ থেকে ছোট বা সমান হবে।আর লুপটি প্রতিবার ১ করে বাড়বে।কোডটি রান করলে আউটপুট আসবে এমন- The number is 1 The number is 2 The number is 3 The number is 4 The number is 5 এবার এর মান ৬ দিলে কি আউটপুট আসবে? কিছুই আসবেনা কারন তখন এটি while loop এর সাথে মিলবেনা তাই কোড execute হবেনা। Do…while loop

    এটা while loop এর মতই শুধু পার্থক্য এটুকু যে condition টি শেষে test করা হয়,শুরুতে করার পরিবর্তে,যেটা হয় while লুপ এ। অর্থাৎ কমপক্ষে একবার লুপ টি execute হবেই।


    Code to be executed

    যেমন নিচের উদাহরনটির কোডটিও উপরের মত একই আউটপুট দেবে শুধু কাজ করবে ভিন্নভাবে।

    echo "The number is " . $i . "<br />";
    while ($i<=5);

    কিন্তু এখানে যদি i=6 দেই তাহলে কি হবে?নিচের মত
    This is line 6
    This line is outside while it will not repeat.
    দেখুন লুপ টি প্রথমবার চেকিং ছাড়াই একবার কোড execute হয়েছে।প্রথমবার execution এর পর চেক করেছে যে লুপটি repeat হবে কিনা?কিন্তু while loop এ প্রথমবারই এই চেক হয়।

    ফর লুপ

    এই লুপ টি একটু জটিল।ফর লুপ এর কাজ while লুপ দিয়েও হয়,তবে কিছু সুবিধার কারনে এটি ব্যাহৃত হয়।


    for (init; condition; increment)
    code to be executed;
  • for loop statement ব্রাকেটের ভিতর ৩টি expression নেয় যেগুলো সেমিক্লোন দ্বারা বিভক্ত হয়।
    ১ম টি assignment statement(loop control variable),প্রথমবার লুপটি পূনরাবৃত্তির আগেই এটা একবার execution হয়।
  • ২য় টি Boolean expression যেটা প্রতিবার পূনরাবৃত্তির আগেই একবার এর মান নির্নীত(evaluate)হয়,এই মান true হলে পূনরাবৃত্তি চলবে আর false return করে তাহলে পূনরাবৃত্তি বন্ধ হয়ে যাবে।
  • ৩য় টি দিয়ে loop control variable এর মান বাড়াতে বা কমাতে ব্যাবহৃত হয়।
  • নিচের উদাহরনটি দেখুন লুপটি শুরু হয়েছে i=1 দিয়ে এবং এটি চলবে যতক্ষন I এর মান ৫ এর চেয়ে ছোট বা সমান হয়।আর I এর মান ১ করে বাড়বে।

    for ($i=1; $i<=5; $i++)
    echo "The number is " . $i . "<br />";


    The number is 1
    The number is 2
    The number is 3
    The number is 4
    The number is 5

    যেকোন expression ফাকা বা একটিতে একাধিক expression থাকতে পারে,যেগুলো কমা দ্বারা বিভক্ত হবে। যদি Boolean expression ফাকা থাকে তাহলে এর default মান true হয়। এই উদাহরনে সবগুলির আউটপুট ১-১০ হবে।
    আরেকটা লুপ আছে নাম foreach loop এটি array এর সাথে ব্যাবহৃত হয় তাই পরে আসছি।