Thursday, 1 October 2009

How To Enable DataInifile In Mysql On A cPanel Server

Just add following code in /etc/my.cnf

local-infile=1

And then restart Mysql

Hardening of PHP

Hardening PHP
Run As The User Instead of “nobody” . You can run PHP as the user (like CGI scripts do with Apache’s suexec)

Enable suPHP


PHP scripts are executed by the user who owns the VirtualHost serving the request.

Use Hardening Tools Like phpsuhosin

Remove Insecure Scripts


Apache directives like php_value are not valid for mod_suphp. It is possible to place a php.ini file in the directory containing the PHP script and specify these types of values in it.


For PHP scripts to execute, permissions of 0400 are sufficient. Scripts are run as the user who owns the VirtualHost, and as long as this user has permissions sufficient to write to a file/directory, PHP scripts will also have the ability to do so. Mod_SuPHP performs various security checks before executing PHP scripts. Most can be disabled in Mod_SuPHP configuration file located at /opt/suphp/etc/suphp.conf

How to moving /var/lib/mysql

If you want to move the data which is stored in “/var” to another partition.


To move that path to another partition, run the following:



# cd /home
# mkdir mysql
# chown mysql:mysql mysql
# cd mysql
# /sbin/service mysqld stop
# cp -Rp /var/lib/mysql/* .
# cd /var/lib
# mv mysql mysql_old
# ln -s /home/mysql ./mysql
# /sbin/service mysqld start

Once satisfied that mysqld is running, remove the old data:


# rm -rf mysql_old

Wordpress Error – “Allowed memory size of 8388608 bytes

You sometimes might get the following error if you are trying to import a previous blog into a newly installation of Wordpress through an RSS feed or while installing a new plugin as:

Allowed memory size of 8388608 bytes exhausted (tried to allocate xxxxx bytes)

This means that the server is not allowing to process the size of the data than its maximum alloted size. Remember that there is nothing wrong with the Wordpress installation. Its the matter of the amount of data that the server can process at one time.

Don’t be scared, you can get it resolved in a matter of seconds. There are two ways of resolving this error.

Method #1 : Without Restarting the Server

If the error mentioned appears during the importing, what you need to do is getaccess to the source code of the Wordpress where you have done the installation.

Once you get the access you will need to modify two files . They are:

/wp-admin/import.php

/wp-admin/import/wordpress.php

Now copy this line of code:

ini_set('memory_limit','16M');

This line increases the server processing capacity by the included size i.e 16M.

Paste the above line in the import.php file just after the line of code:

require_once ('admin-header.php');

Now in the second file i.e. wordpress.php paste the code after the line of code:

<?php

Note: If the error mentioned appears during the installation of a

plugin then make a note of the path and the .php page which is given out in the error and paste the same line in the mentioned .php page.Remember, the code must be pasted within the php code block i.e in between in the page since it is to be executed by the server.

Now once again access your Wordpress URL and go to the manage > import menu and try importing. If your problem still remains, just keep increasing the size mentioned in the pasted code in multiples of 4 i.e. in place of “16M”, try “20M”, “24M” etc.

Method #2 : Which Requires a Server Restart

If you want to eliminate this error once and for all then you need to target your server to make the changes.

But you should have the permissions to restart the server.

If you have this permission then go to the server installed path and search for the file php.ini file. In this file there will numerous things mentioned. But all you have to do is search for the term “memory_limit“. Change the value of this variable from 8M to either 16M, 24M, etc as required.

Save the file and restart your server. The error will be resolved once and for all. Good luck!

You sometimes might get the following error if you are trying to import a previous blog into a newly installation of Wordpress through an RSS feed or while installing a new plugin as:

Allowed memory size of 8388608 bytes exhausted (tried to allocate xxxxx bytes)

This means that the server is not allowing to process the size of the data than its maximum alloted size. Remember that there is nothing wrong with the Wordpress installation. Its the matter of the amount of data that the server can process at one time.

Don’t be scared, you can get it resolved in a matter of seconds. There are two ways of resolving this error.

Method #1 : Without Restarting the Server

If the error mentioned appears during the importing, what you need to do is getaccess to the source code of the Wordpress where you have done the installation.

Once you get the access you will need to modify two files . They are:

/wp-admin/import.php

/wp-admin/import/wordpress.php

Now copy this line of code:

ini_set('memory_limit','16M');

This line increases the server processing capacity by the included size i.e 16M.

Paste the above line in the import.php file just after the line of code:

require_once ('admin-header.php');

Now in the second file i.e. wordpress.php paste the code after the line of code:

<?php

Note: If the error mentioned appears during the installation of a plugin then make a note of the path and the .php page which is given out in the error and paste the same line in the mentioned .php page.Remember, the code must be pasted within the php code block i.e in between in the page since it is to be executed by the server.

Now once again access your Wordpress URL and go to the manage > import menu and try importing. If your problem still remains, just keep increasing the size mentioned in the pasted code in multiples of 4 i.e. in place of “16M”, try “20M”, “24M” etc.

Method #2 : Which Requires a Server Restart

If you want to eliminate this error once and for all then you need to target your server to make the changes.

But you should have the permissions to restart the server.

If you have this permission then go to the server installed path and search for the file php.ini file. In this file there will numerous things mentioned. But all you have to do is search for the term “memory_limit“. Change the value of this variable from 8M to either 16M, 24M, etc as required.

Save the file and restart your server. The error will be resolved once and for all. Good luck!

Root Login Email Notification

configuring your server so that when someone logs in with root or su, your server will notify you via email.

Please use an email address that is NOT hosted on your server as a hacker could merely delete the emails right off the server.

Login to your server with root

Use any editor to edit .bash_profile

At the end of the file, place the following lines:

echo ‘WARNING – Root Login detected on:’ `date` `who` | mail -s “WARNING -
Root Login: `who | awk ‘{print $6}’`” youremail@domain.com


Now anytime someone gains root access you will be notified via email.

The 10 biggest moments in IT history

It’s unlikely that everyone will ever agree on the most important dates in the history of IT. I know my IT timeline has a personal and professional bias. But I’ve tried to be objective in examining the events that have served to shape the current landscape of the modern computing industry. Some of the milestones on my list are debatable (depending upon where you are looking from), but some of them most likely are not. Read on and see what you think.

1: The development of COBOL (1959)


There are many languages out there, but none has influenced as many others as COBOL has. What makes COBOL stand out is the fact that there are still machines chugging along, running COBOL apps. Yes, these apps could (and possibly should) be rewritten to a modern standard. But for many IT administrators, those who don’t have the time or resources to rewrite legacy apps, those programs can keep on keeping on.

2: The development of the ARPANET (1969)


It is an undeniable fact that the ARPANET was the predecessor of the modern Internet. The ARPANET began in a series of memos, written by J.C. R. Licklider and initially referred to as the “Intergalactic Computer Network.” Without the development of the ARPANET, the landscape of IT would be drastically different.

3: The creation of UNIX (1970)


Although many would argue that Windows is the most important operating system ever created, UNIX should hold that title. UNIX started as a project between MIT and AT&T Bell Labs. The biggest initial difference (and most important distinction) was that it was the first operating system to allow more than one user to log in at a time. Thus was born the multi-user environment. Note: 1970 marks the date the name “UNIX” was applied.

4: The first “clamshell” laptop (1979)


William Moggridge, working for GRID Systems Corporation, designed the Compass Computer, which finally entered the market in 1991. Tandy quickly purchased GRID (because of 20 significant patents it held) but then turned around and resold GRID to AST, retaining the rights to the patents.

5: The beginning of Linus Torvalds’ work on Linux (1991)


No matter where you stand on the Linux versus Windows debate, you can’t deny the importance of the flagship open source operating system. Linux brought the GPL and open source into the forefront and forced many companies (and legal systems) into seeing monopolistic practices as well as raising the bar for competition. Linux was also the first operating system that allowed students and small companies to think in much bigger ways than their budgets previously allowed them to think.

6: The advent of Windows 95 (1995)


Without a doubt, Windows 95 reshaped the way the desktop looked and felt. When Windows 95 hit the market the metaphor for the desktop became standardized with the toolbar, start menu, desktop icons, and notification area. All other operating systems would begin to mimic this new de facto standard desktop.

7: The 90s dot-com bubble (1990s)


The dot-com bubble of the 90s did one thing that nothing else had ever done: It showed that a great idea could get legs and become a reality. Companies like Amazon and Google not only survived the dot-com burst but grew to be megapowers that have significant influence over how business is run in the modern world. But the dot-com bubble did more than bring us companies — it showed us the significance of technology and how it can make daily life faster, better, and more powerful.

8: Steve Jobs rejoining Apple (1996)


Really, all I should need to say here is one word: iPod. Had Jobs not come back to Apple, the iPod most likely would never have been brought to life. Had the iPod not been brought to life, Apple would have withered away. Without Apple, OS X would never have seen the light of day. And without OS X, the operating system landscape would be limited to Windows and Linux.

9: The creation of Napster (1999)


File sharing. No matter where you stand on the legality of this issue, you can’t deny the importance of P2P file sharing. Without Napster, file sharing would have taken a much different shape. Napster (and the original P2P protocols) heavily influenced the creation of the BitTorrent protocol. Torrents now make up nearly one-third of all data traffic and make sharing of large files easy. Napster also led to the rethinking of digital rights (which to some has negative implications).

10: The start of Wikipedia (2000)


Wikipedia has become one of leading sources of information on the Internet and with good reason. It’s the single largest collaborative resource available to the public. Wikipedia has since become one of the most often cited sources on the planet. Although many schools refuse to accept Wiki resources (questioning the legitimacy of the sources) Wikipedia is, without a doubt, one of the largest and most accessible collections of information. It was even instrumental in the 2008 U.S. presidential election, when the candidates’ Wiki pages became the top hits for voters seeking information. These presidential Wiki pages became as important to the 2008 election as any advertisement.

How to disable and uninstall APF Firewall Script

Q. How do I uninstall and disable APF Firewall script under CentOS / Red Hat Enterprise Linux without breaking anything else?

A. You can easily disable and uninstall APF firewall script under any Linux distributions. Simply type the following command as root user.

Linux Remove APF firewall


Type the following commands:

# service iptables stop
# chkconfig apf off
# /bin/rm -rfv /etc/apf
# /bin/rm -fv /etc/cron.daily/fw
# /bin/rm -fv /etc/init.d/apf
# iptables -L -n