Limit IP downloads in Apache – Save Bandwidth Published: Nov 04, 2005
  • Rating

    5/5

MySQL 4.1 has been available for quite some time but many server admins still haven’t gotten around to getting their MySQL 4.0 upgraded to 4.1 We offer a quick and easy method to get this accomplished through your Cpanel/WHM server.

MySQL 4.1

Upgrading MySQL 4.0 to 4.1 in Cpanel

Overview:
MySQL 4.1 has been available for quite some time but many server admins still haven’t gotten around to getting their MySQL 4.0 upgraded to 4.1 We offer a quick and easy method to get this accomplished through your Cpanel/WHM server.

You’ll need about 30-45 minutes to complete this, maybe a bit longer. We have to update Cpanel, update MySQL and rebuild Apache/PHP.

Check what version of MySQL you currently have installed. It’s probably 4.0x but you can check through shell by doing the following:

# mysql -V


Upgrading MySQL 4.0 to 4.1
There are some excellent documentation and notes you should read before proceeding with this upgrade tutorial. We aren’t going to cover everything so I suggest you take a minute to read this, upgrading MySQL is a major upgrade and is irreversible!

http://dev.mysql.com/doc/refman/4.1/en/upgrading-from-4-0.html


Installing MySQL 4.1 - the upgrade begins

The first thing we need to do is make sure Cpanel is updated to the latest version. You can do the update through WHM Upgrade to Latest Version or through shell

# /scripts/upcp

Once the update completes you want to go into WHM.

Server Configuration, Tweak Settings section

WHM MySQL

Select MySQL 4.1 option, do no check use old authentication.

Scroll to the bottom and hit Save.


You’ll then see the next screen such as this:
Your changes have been saved
If you made changes to the mysql version, please Click Here  after waiting 30 seconds  to have them take effect.
Restarting....Done

So we’ll wait 30 seconds and then click the link =)

Cpanel will then go through a bit process of grabbing the latest MySQL version 4.1.13 at the time of this tutorial and install it automatically through RPMs.
Once this page completes you need to do a few more steps to complete the update.

You should see a Complete message that’s bolded when its done.

Updating PHP to support MySQL 4.1
Now you need to recompile Apache/PHP to support the changes as quick as possible because PHP will currently not work with MySQL. You might see something like this in console:

# php -v
php: error while loading shared libraries: libmysqlclient.so.12: cannot open shared object file: No such file or directory

This is normal and fine, lets proceed with the Apache update. See our detailed /scripts/easyapache tutorial here.

# /scripts/easyapache

Don’t change any of the default MySQL options here, select the other settings you want. Save the changes and let it rebuild. This usually takes 20 minutes or so to complete:

 

Now that Apache has finished recompiling we want to make sure it works properly! In shell again do the following command. It should produce your PHP version information without any errors:

# php –v
PHP 4.4.1 (cli) (built: Dec  8 2005 20:57:56)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies

You can also check the MySQL version with the following:

# mysql –V
mysql  Ver 14.7 Distrib 4.1.13, for pc-linux-gnu (i686) using readline 4.3

Upgrade is complete! Give yourself a pat on the back for some hard work and take a deep breath because you got through this haha =)

MySQL 4.1 upgrade Problems?

Make sure you follow all the steps, especially rebuilding Apache/PHP if you don’t the libraries will be out of sync and no websites will be able to connect to databases.

Notes:
The 4.0 to 4.1 MySQL upgrade changes many aspects of databases. For example, when you’re trying to restore a 4.0 database to a 4.1 database it will not work. The opposite is also true. This is because it ads new fields, etc to tables that each version doesn’t support. So if you have many machines, upgrade them all or none because if you’re moving databases around you’re going to hit a brick wall.

Having trouble getting this tutorial to work? We can do this update for you on your server, simply contact us for a quote.

About the Author:
Steven Leggett is the editor of the server resource and hosting tutorial site, www.webhostgear.com and specializes in system administration and web development.

  • Rating

    5/5

Related Articles

Comments (16)

  • Gravatar - David K
    David K 20:31, December 19, 2005
    Thaks for this walkthru--I've implemented it on my Apache 2.0 runing on Win2K server and it works perfectly.<br />
    The only issue I saw was that .rm files weren't recognized as video, so I removed the <br />
    OnlyIPLimit audio/mpeg video<br />
    line in <Location /...><br />
    Thaks again!
  • Gravatar - Mih
    Mih 21:02, December 26, 2005
    I have also implemented on RHE3 Cpanel it but on my folder i have downloads stuff like .rar exe zip or pdf files. <br />
    <br />
    I would like to know what i write instead this syntax:<br />
    <br />
    OnlyIPLimit audio/mpeg video<br />
    <br />
    Thanks for your co operation and your efforts are appreciable.
  • Gravatar - MrPC
    MrPC 05:41, January 4, 2006
    I get this when type "make". Can some1 help me out?<br />
    ===================<br />
    root@home [~/mod_limitipconn-0.22]# make<br />
    /usr/local/apache/bin/apxs -c mod_limitipconn.c<br />
    gcc -DLINUX=22 -DHAVE_SET_DUMPABLE -I/usr/include/gdbm -DMOD_SSL=208125 -DUSE_HSREGEX -DEAPI -fpic -DSHARED_MODULE -I/usr/local/apache/include -c mod_limitipconn.c<br />
    mod_limitipconn.c:34:20: ap_mpm.h: No such file or directory<br />
    mod_limitipconn.c:35:25: apr_strings.h: No such file or directory<br />
    mod_limitipconn.c:41: error: syntax error before "limitipconn_module"<br />
    mod_limitipconn.c:41: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:47: error: syntax error before "apr_array_header_t"<br />
    mod_limitipconn.c:47: warning: no semicolon at end of struct or union<br />
    mod_limitipconn.c:49: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:51: error: syntax error before '}' token<br />
    mod_limitipconn.c:51: warning: data definition has no type or storage class<br />
    mod_limitipconn.c:53: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `limitipconn_create_dir_config':<br />
    mod_limitipconn.c:55: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:55: error: (Each undeclared identifier is reported only once<br />
    mod_limitipconn.c:55: error: for each function it appears in.)<br />
    mod_limitipconn.c:55: error: syntax error before ')' token<br />
    mod_limitipconn.c:60: error: `p' undeclared (first use in this function)<br />
    mod_limitipconn.c: In function `limitipconn_handler':<br />
    mod_limitipconn.c:69: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:69: error: syntax error before ')' token<br />
    mod_limitipconn.c:70: error: request for member `module_index' in something not a structure or union<br />
    mod_limitipconn.c:89: error: `worker_score' undeclared (first use in this function)<br />
    mod_limitipconn.c:89: error: `ws_record' undeclared (first use in this function)<br />
    mod_limitipconn.c:100: error: too many arguments to function `ap_sub_req_lookup_uri'<br />
    mod_limitipconn.c:174: error: `SERVER_IDLE_KILL' undeclared (first use in this function)<br />
    mod_limitipconn.c:176: error: `SERVER_CLOSING' undeclared (first use in this function)<br />
    mod_limitipconn.c:184: warning: passing arg 5 of `ap_log_rerror' from incompatible pointer type<br />
    mod_limitipconn.c: In function `limit_config_cmd':<br />
    mod_limitipconn.c:198: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:198: error: syntax error before ')' token<br />
    mod_limitipconn.c: In function `no_limit_config_cmd':<br />
    mod_limitipconn.c:216: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:216: error: syntax error before ')' token<br />
    mod_limitipconn.c:218: warning: assignment makes pointer from integer without a cast<br />
    mod_limitipconn.c: In function `excl_limit_config_cmd':<br />
    mod_limitipconn.c:226: error: `cfg' undeclared (first use in this function)<br />
    mod_limitipconn.c:226: error: syntax error before ')' token<br />
    mod_limitipconn.c:228: warning: assignment makes pointer from integer without a cast<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:235: error: initializer element is not constant<br />
    mod_limitipconn.c:235: error: (near initialization for `limitipconn_cmds[0].name')<br />
    mod_limitipconn.c:237: error: initializer element is not constant<br />
    mod_limitipconn.c:237: error: (near initialization for `limitipconn_cmds[0].func')<br />
    mod_limitipconn.c:239: error: initializer element is not constant<br />
    mod_limitipconn.c:239: error: (near initialization for `limitipconn_cmds[0].cmd_data')<br />
    mod_limitipconn.c:240: warning: braces around scalar initializer<br />
    mod_limitipconn.c:240: warning: (near initialization for `limitipconn_cmds[0].req_override')<br />
    mod_limitipconn.c:240: warning: initialization makes integer from pointer without a cast<br />
    mod_limitipconn.c:241: error: initializer element is not constant<br />
    mod_limitipconn.c:241: error: (near initialization for `limitipconn_cmds[0]')<br />
    mod_limitipconn.c:244: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `limitipconn_init':<br />
    mod_limitipconn.c:246: error: `s' undeclared (first use in this function)<br />
    mod_limitipconn.c:248: error: `AP_MPMQ_HARD_LIMIT_THREADS' undeclared (first use in this function)<br />
    mod_limitipconn.c:249: error: `AP_MPMQ_HARD_LIMIT_DAEMONS' undeclared (first use in this function)<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:253: error: syntax error before '*' token<br />
    mod_limitipconn.c: In function `register_hooks':<br />
    mod_limitipconn.c:255: error: `APR_HOOK_MIDDLE' undeclared (first use in this function)<br />
    mod_limitipconn.c: At top level:<br />
    mod_limitipconn.c:259: error: syntax error before "limitipconn_module"<br />
    mod_limitipconn.c:260: error: `STANDARD20_MODULE_STUFF' undeclared here (not in a function)<br />
    mod_limitipconn.c:260: error: initializer element is not constant<br />
    mod_limitipconn.c:260: error: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:261: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:261: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:262: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:262: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:263: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:263: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:264: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:264: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:265: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:265: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:267: warning: excess elements in scalar initializer<br />
    mod_limitipconn.c:267: warning: (near initialization for `limitipconn_module')<br />
    mod_limitipconn.c:267: warning: data definition has no type or storage class<br />
    apxs:Break: Command failed with rc=1<br />
    make: *** [mod_limitipconn.so] Error 1<br />
  • Gravatar - Nick
    Nick 16:23, January 31, 2006
    Thank you very much man. I have some DOS attacks in my server those days, and this is really helpfull :)
  • Gravatar - Frosty
    Frosty 09:55, February 23, 2006
    Very helpful there too :-)<br />
    Many thanks.
  • Gravatar - konnor
    konnor 15:16, April 17, 2006
    Wow! Man, really really thank you for this stuff! It works perfectly! (After I set up the ExtendedStatus directive ;))<br />
    Last night I had a bloody DOS attack on my web server - I hope this stuff protect my server in the future. Thanks again!
  • Gravatar -  A server admin
    A server admin 13:34, July 28, 2006
    How do you make this if you have direct physical access to the webserver. And do not need to login to the server. Specifically on a Windows apache server.??
  • Gravatar - kon
    kon 12:10, March 18, 2007
    I am guessing this is only for a full Server root access and not for someone who is on shared hosting...?
  • Gravatar - fabiOne
    fabiOne 12:04, May 4, 2007
    Good, good, good. You have complete a perfect job for many people.<br />
    Many thanks.
  • Gravatar - RTG (Asia) Network
    RTG (Asia) Network 15:51, August 21, 2007
    The link no longer works.<br />
  • Gravatar - NobodyHasGottaBodyLikeMe
    NobodyHasGottaBodyLikeMe 23:18, June 16, 2008
    One thing I found: You may get a lot of false positives if you have KeepAlive enabled in Apache, since by default it keeps each connection open for 15 seconds. So if the user hits several pages in succession while using a lame browser, they may get a 503 error when they aren't doing anything objectionable.<br />
  • Gravatar - lovelu
    lovelu 20:20, October 30, 2008
    its work for mp3 file. but it does not working for pdf file. what to do?
  • Gravatar - Farzin Sadeghi
    Farzin Sadeghi 08:39, January 2, 2010
    Thanks man. you saved my life !! :D <br />
    it works like a charm. :D<br />
    <br />
    -------------<br />
    to lovelu<br />
    if u want to limit other file types<br />
    u should add the extension to your active mime.conf and then add the disable extension with a "space" , like this :<br />
    OnlyIPLimit audio/mpeg video aplication/pdf extension1 extension2 ... and so on.<br />
    or every thing esle u defined in mime.conf :D
  • Gravatar - Farzin
    Farzin 16:50, January 17, 2010
    hi , thanks for great post.<br />
    <br />
    is it possible to limit connections per file ? for example limiting ip to 2 , but also letting them download 5 files at the same time.<br />
    that counts 10 connections.<br />
    but it is devided between 5 files automatically. <br />
    can it be possible ?
  • Gravatar - John
    John 20:07, October 13, 2010
    Hello,

    How to uninstall this ?

    Thanks in advance

Add Your Thoughts

WebHostGear.com is a hosting directory, not a web host.

Copyright © 1998-2017 WebHostGear.com