Fast CGI Upload Error

[stextbox id=”warning”]mod_fcgid: HTTP request length 16779013 (so far) exceeds MaxRequestLen (16777216), referer[/stextbox]

Getting an error on a plesk server witht he site running fastcgi and the upload times out or you get an error:

mod_fcgid: HTTP request length 16779013 (so far) exceeds MaxRequestLen (16777216), referer:



The FcgidMaxRequestLen directive was changed from 1GB to 128KB in the mod_fcgid package, causing the limit to be triggered in many cases (source).


The issue has been fixed since version 10.4.4, patch version = “43.”
It is fixed by setting MaxRequestLen to 15MB.
Consider upgrading your Parallels Plesk Panel installation.


1. Change the value of MaxRequestLen in domainVirtualHost.php template.

Important: Do not change the default template. To introduce your changes to the configuration, copy the  /usr/local/psa/admin/conf/templates/default/domain/domainVirtualHost.php file to the /usr/local/psa/admin/conf/templates/custom/domain directory and then modify the copied file. See KB #115277 for more information.

2. Reconfigure domains:

/usr/local/psa/admin/bin/httpdmng --reconfigure-all

Install the Memcache PECL Extension

The easiest installation method for memcache is to use PECL’s ‘install’ command. This will grab the latest stable release, configure it with the default options, and add it to the server’s php.ini:

pecl install memcache

Un-installation is just as easy:

pecl uninstall memcache

Now add the extension so it will load

nano /etc/php.d/memcache.ini

Add the following

; Enable memcache extension module

Restart apache

service httpd restart

The quick install method for memcache uses the default configuration options and should serve most users’ purposes. However, if you need more control over the installation options, you can manually install from source and add it flags as you need.

1. Download the source package via PECL:

cd /usr/local/src/
pecl download memcache

2. Unpack the tar and enter into the newly extracted directory (be sure to replace the X’s with your downloaded version):

tar -xvzf memcache-X.X.X.tgz
cd memcache-X.X.X

3. Configure and install:

./configure –with-php-config=/usr/local/bin/php-config

Note: If you are working on a server with cPanel, keep in mind that cPanel itself installs two versions of php:


For that reason you have to know which version your web server is actually using. Most of the time it is /usr/local/bin/php. It can get very confusing and can be different from server to server. If you are a ServInt customer, don’t hesistate to fill out a support ticket if you have any questions.

4. Verify the install:

Verify the installation by displaying all the installed PHP modules. See if memcache is listed:

php -m
Problems with manual installation

The “make install” should load the module into your server’s extension directory automatically. However, if you do not see memcache listed in a “php -m”, you will need to add the module manually.

1. First, verify the location of your server’s extensions directory:

grep extension_dir /usr/local/lib/php.ini

It should return something similar to the following:

extension_dir = “/usr/local/lib/php/extensions/no-debug-non-zts-20060613″

2. Next, copy the memcache module into that directory (be sure to replace the path with the one found on your server):

cp modules/ /usr/local/lib/php/extensions/no-debug-non-zts-20060613

3. Finally, add the module to your php.ini:

echo ‘’ >> /usr/local/lib/php.ini
Final Thoughts

It used to be a common issue that the quick ‘install’ method could not be used for servers where the /tmp partition was mounted “noexec”. The problem was that the “configure” process could not execute because the PECL client downloaded the module into in /tmp. When /tmp is mounted “noexec”, servers cannot execute scripts from /tmp.

Install Memcached


Memcached is a general-purpose, free and open-source distributed memory caching system. It is one of the most popular caching tools and is used in such popular sites as YouTube, Reddit, Zynga, Facebook, and Twitter. If you also run dynamic, database-driven sites, Memcached may reduce resource consumption and speed up page delivery on your server as well.

Installing Memcached (daemon)

The quickest and easiest method is to install Memcached via Yum on the command line of your server.

1. Grab the RPM that matches your OS:

CentOS 6 (64 bit):

su -c ‘rpm -Uvh’

CentOS 6 (32 bit):

su -c ‘rpm -Uvh’

CentOS 5 (64 bit):

su -c ‘rpm -Uvh’

CentOS 5 (32 bit):

su -c ‘rpm -Uvh’

2. Install it with Yum:

yum install memcached

3. Start the memcached service:

/etc/init.d/memcached start

4. Configure the memcached service to start when the server boots:

chkconfig memcached on

5. Finally, disable the RPM so that it is not used for future Yum functions:

perl -pi -e “s/enabled=1/enabled=0/g;” /etc/yum.repos.d/epel.repo

ProFTP – Fatal: error processing configuration file ‘/etc/proftpd.conf’


telnet 216.55.131.xx 21
Trying 216.55.131.xx…
Connected to (
Escape character is ‘^]’. proftpd[20885]: error: no valid servers configured proftpd[20885]: Fatal: error processing configuration file ‘/etc/proftpd.conf’
Connection closed by foreign host.

Simply run:

hostname yourservername.tld


nano /etc/hosts


Restart ftp

service xinetd restart
Categories FTP

Remove SSL default Cert on Plesk 11.0.9

Log into mysql.

mysql -uadmin -p`cat /etc/psa/.psa.shadow`

mysql> select dom_id,certificate_id from hosting where dom_id=13;
| dom_id | certificate_id |
| 13 | 0 |
1 row in set (0.00 sec)

mysql> SELECT * FROM IP_Addresses;
| id | serviceNodeId | ip_address | mask | iface | ssl_certificate_id | default_domain_id | ftps | main | status |
| 1 | 1 | | | eth0 | 2 | 0 | false | true | 0 |
1 row in set (0.00 sec)

mysql> UPDATE IP_Addresses SET ssl_certificate_id = 0;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT id, name FROM certificates;
| id | name |
| 1 | |
| 2 | default certificate |
| 3 | default certificate |
3 rows in set (0.00 sec)

mysql> quit


[root@DS29440 ~]# /usr/local/psa/admin/sbin/httpdmng --reconfigure-all

Restart Apache

[root@DS29440 ~]# service httpd restart

MySQL’s wait_timeout and interactive_timeout Variables

Ever get these errors?

Mysql reporting error when accessing plesk. Zend_Db_Adapter_Exception: SQLSTATE[08004] [1040] Too many connections.

You can set-variable=max_connections=250 to /etc/my.cnf and restart and use mysql close statements for php code.

Or, set up mysql to close sleeping processes.

Mysql Config. (/etc/my.cnf)
wait_timeout variable represents the amount of time that MySQL will wait before killing an idle connection.
The default wait_timeout variable is 28800 seconds, which is 8 hours. That’s a lot.

Sometimes, putting wait_timeout too low (e.g. 30, 60, 90) can result in MySQL has gone away error messages. You’ll have to decide for your configuration.

How to change it.

Step 1) Edit your /etc/my.cnf file and enter the following 2 values.


Step 2) run the command and enter your root password

mysql -uroot -p -e"SET GLOBAL wait_timeout=300; SET GLOBAL interactive_timeout=300;"

If you are connected from the mysql console
e.g. mysql> you can run this command which will show you global and session variables.

SELECT @@global.wait_timeout, @@global.interactive_timeout, @@session.wait_timeout, @@session.interactive_timeout;

| @@global.wait_timeout | @@global.interactive_timeout | @@session.wait_timeout | @@session.interactive_timeout |
|                   300 |                          300 |                  28800 |                         28800 |
1 row in set (0.00 sec)

To see the the current values you can run this command

mysql> show global variables like '%timeout%';

| Variable_name              | Value    |
| connect_timeout            | 10       |
| delayed_insert_timeout     | 300      |
| innodb_lock_wait_timeout   | 50       |
| innodb_rollback_on_timeout | OFF      |
| interactive_timeout        | 300      |
| lock_wait_timeout          | 31536000 |
| net_read_timeout           | 30       |
| net_write_timeout          | 60       |
| slave_net_timeout          | 3600     |
| wait_timeout               | 300      |
10 rows in set (0.00 sec)

Generate and Install SSL in Plesk

You can generate the CSR and Private Key in Plesk itself by following the steps listed below, after that is done you will follow the second set of steps to upload the SSL and CA bundle provided to you from your SSL provider.

For Plesk 11.5

How to request a CSR in Plesk
1. Log into your Plesk control panel.
2. Click on “Domains” on the left hand side.
3. Find the domain in the list you wish to generate the CSR for, then click on “Manage Hosting” on the right hand side of the domain.
4. Click on the domain name in big bolded letters ( it should say “Hosting Settings” right next to the place you want to click).
5. Click on “Secure Your Sites”.
6. Click the “Add SSL Certificate” button.
7. Once there, fill out the information for “Certificate Name” (typically this is the name of the domain and the year/month the SSL has been issued, so that it makes it easier to figure out when the SSL will need to be renewed and how long it is good for) and under “Settings” (This would be your company’s information).
8. Once that is all filled out, click the “Request” button, this will generate the CSR and private key for that specific domain.
9. After the CSR is generated it should appear underneath the text boxes that you can use to upload a certificate, you will copy all of this and provide it to the SSL provider.

How to install a SSL Certificate in Plesk.
1. Log into your Plesk control panel.
2. Click on “Domains” on the left hand side.
3. Find the domain in the list you wish to install the SSL for, then click “Manage Hosting” on the right hand side of the domain.
4. Click on your domain name that you are trying to generate the CSR for, it will be in larger bolder letters with “Hosting Settings” right next to it, however you will want to click on the domain name itself.
5. Click on “Secure Your Sites”.
6. Find the SSL in the list that you added to generate the CSR so that you could get the SSL.
7. Once there, either upload the certificate documents that the SSL provider has given you, or if you have the text (which you can get by opening the files provided to you in a text editor) you can copy and paste them into the text boxes. After doing so you would either click “Send Text” or “Send File”.
8. Next you will need to ensure the new SSL is active for the domain, you will go back to click on the domain name in big bolded letters ( it should say “Hosting Settings” right next to the place you want to click), and click the “Hosting Settings” that were next to the domain.
9. On this page towards the middle of it you should see a “Security” section, if the “SSL Support” box is not checked you will need to check here, and then from the certificate dropdown menu you would select the new SSL that you uploaded and then select “OK” at the bottom of the page.

For Plesk Onyx:

Or follow these plesk articles:
What you would want to do is first generate a CSR in Plesk and provide that to your SSL provider. To do that you would follow this article first:

Then they would give you the SSL to install on the server. For that you follow this article:

DNS Glue records in WHM

You must add this DNS glue record to use you nameservers.

  1. Log into WHM.
  2. Navigate to the DNS Functions section.
  3. Click on the Edit DNS Zone option.
  4. Select the domain that you need to add the Records to.
  5. Click the Edit button and wait for the page to load.
  6. In the first blank, type ns1.
  7. Skip the box with 14400, and go to the drop-down box.
  8. In the drop-down box, select A. A new box will appear.
  9. Erase the IP or hostname within the box.
  10. Type in the IP address for the NS1 private nameserver.
  11. In the second blank, type ns2.
  12. Skip the box with 14400, and go to the drop-down box.
  13. In the drop-down box, select A. A new box will appear.
  14. Erase the IP or hostname within the box.
  15. Type in the IP address for the NS2 private nameserver.
  16. Scroll all the way down to the bottom of the page and click the Save button.

When you get to the last step, your A record entries should look similar to the following:

Glue Record

MySQL InnoDB Recovery

Mysql Recovery. Error logs shows:

InnoDB: Database page corruption on disk or a failed
InnoDB: file read of page 7.
InnoDB: You may have to recover from a backup.
080703 23:46:16 InnoDB: Page dump in ascii and hex (16384 bytes):
080703 23:46:16 InnoDB: Page checksum 587461377, prior-to-4.0.14-form checksum 772331632
InnoDB: stored checksum 2287785129, prior-to-4.0.14-form stored checksum 772331632
InnoDB: Page lsn 24 1487506025, low 4 bytes of lsn at page end 1487506025
InnoDB: Page number (if stored to page already) 7,
InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 6353
InnoDB: Page may be an index page where index id is 0 25556
InnoDB: (index “PRIMARY” of table “test”.”test”)
InnoDB: Database page corruption on disk or a failed

When page in clustered key index is corrupted. It is worse compared to having data corrupted in secondary indexes, in which case simple OPTIMIZE TABLE could be enough to rebuild it, but it is much better compared to table dictionary corruption when it may be much harder to recover the table.

Manually edited test.ibd file replacing few bytes so corruption is mild.

First I should note CHECK TABLE in INNODB is pretty useless. For my manually corrupted table I am getting:

mysql check table test;
ERROR 2013 (HY000): Lost connection to MySQL server during query

mysql> check table test;
| Table | Op | Msg_type | Msg_text |
| test.test | check | status | OK |
1 row in set (0.69 sec)

First run is check table in normal operation mode – in which case Innodb simply crashes if there is checksum error (even if we’re running CHECK operation). In second case I’m running with innodb_force_recovery=1 and as you can see even though I get the message in the log file about checksum failing CHECK TABLE says table is OK. This means You Can’t Trust CHECK TABLE in Innodb to be sure your tables are good.

In this simple corruption was only in the data portion of pages so once you started Innodb with innodb_force_recovery=1 you can do the following:

mysql> CREATE TABLE `test2` (
    ->   `c` char(255) DEFAULT NULL,
    ->   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    ->   PRIMARY KEY (`id`)
Query OK, 0 rows affected (0.03 sec)
mysql> insert into test2 select * from test;
Query OK, 229376 rows affected (0.91 sec)
Records: 229376  Duplicates: 0  Warnings: 0

Now you got all your data in MyISAM table so all you have to do is to drop old table and convert new table back to Innodb after restarting without innodb_force_recovery option. You can also rename the old table in case you will need to look into it more later. Another alternative is to dump table with MySQLDump and load it back. It is all pretty much the same stuff. I’m using MyISAM table for the reason you’ll see later.

You may think why do not you simply rebuild table by using OPTIMIZE TABLE ? This is because Running in innodb_force_recovery mode Innodb becomes read only for data operations and so you can’t insert or delete any data (though you can create or drop Innodb tables):

mysql> optimize table test;
| Table     | Op       | Msg_type | Msg_text                         |
| test.test | optimize | error    | Got error -1 from storage engine |
| test.test | optimize | status   | Operation failed                 |
2 rows in set, 2 warnings (0.09 sec)

That was easy, right ?

I also thought so, so I went ahead and edited test.ibd a little more wiping one of the page headers completely. Now CHECK TABLE would crash even with innodb_force_recovery=1

080704 0:22:53 InnoDB: Assertion failure in thread 1158060352 in file btr/btr0btr.c line 3235
InnoDB: Failing assertion: page_get_n_recs(page) > 0 || (level == 0 && page_get_page_no(page) == dict_index_get_page(index))
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to
InnoDB: If you get repeated assertion failures or crashes, even

If you get such assertion failures most likely higher innodb_force_recovery values would not help you – they are helpful in case there is corruption in various system areas but they can’t really change anything in a way Innodb processes page data.

The next comes trial and error approach:

mysql> insert into test2 select * from test;
ERROR 2013 (HY000): Lost connection to MySQL server during query

You may think will will scan the table until first corrupted row and get result in MyISAM table ? Unfortunately test2 ended up to be empty after the run. At the same time I saw some data could be selected. The problem is there is some buffering taking place and as MySQL crashes it does not store all data it could recover to MyISAM table.

Using series of queries with LIMIT can be handly if you recover manually:

mysql> insert ignore into test2 select * from test limit 10;
Query OK, 10 rows affected (0.00 sec)
Records: 10  Duplicates: 0  Warnings: 0
mysql> insert ignore into test2 select * from test limit 20;
Query OK, 10 rows affected (0.00 sec)
Records: 20  Duplicates: 10  Warnings: 0
mysql> insert ignore into test2 select * from test limit 100;
Query OK, 80 rows affected (0.00 sec)
Records: 100  Duplicates: 20  Warnings: 0
mysql> insert ignore into test2 select * from test limit 200;
Query OK, 100 rows affected (1.47 sec)
Records: 200  Duplicates: 100  Warnings: 0
mysql> insert ignore into test2 select * from test limit 300;
ERROR 2013 (HY000): Lost connection to MySQL server during query

As you can see I can get rows from the table in the new one until we finally touch the row which crashes MySQL. In this case we can expect this is the row between 200 and 300 and we can do bunch of similar statements to find exact number doing “binary search”

Note even if you do not use MyISAM table but fetch data to the script instead make sure to use LIMIT or PK Rangers when MySQL crashes you will not get all data in the network packet you potentially could get due to buffering.

So now we found there is corrupted data in the table and we need to somehow skip over it. To do it we would need to find max PK which could be recovered and try some higher values

mysql> select max(id) from test2;
| max(id) |
|     220 |
1 row in set (0.00 sec)
mysql> insert ignore into test2 select * from test where id>250;
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> insert ignore into test2 select * from test where id>300;
Query OK, 573140 rows affected (7.79 sec)
Records: 573140  Duplicates: 0  Warnings: 0

So we tried to skip 30 rows and it was too little while skipping 80 rows was OK. Again using binary search you can find out how many rows do you need to skip exactly to recover as much data as possible. Row size can be good help to you. In this case we have about 280 bytes per row so we get about 50 rows per page so not a big surprise 30 rows was not enough – typically if page directory is corrupted you would need to skip at least whole page. If page is corrupted at higher level in BTREE you may need to skip a lot of pages (whole subtree) to use this recovery method.

It is also well possible you will need to skip over few bad pages rather than one as in this example.

Another hint – you may want to CHECK your MyISAM table you use for recovery after MySQL crashes to make sure indexes are not corrupted.

So we looked at how to get your data back from simple Innodb Table Corruption. In more complex cases you may need to use higher innodb_force_recovery modes to block purging activity, insert buffer merge or recovery from transactional logs all together. Though the lower recovery mode you can run your recovery process with better data you’re likely to get.

In some cases such as if data dictionary or “root page” for clustered index is corrupted this method will not work well – in this case you may wish to use Innodb Recovery Toolkit which is also helpful in cases you’ve want to recover deleted rows or dropped table.

Domain Masking

Domain Masking (a.k.a. Blind Forwarding) is using a domain name to display a different domain, but still shows the original domain’s name in the address bar.

Generally, this is considered a bad idea and not good for SEO, but it is possible.
(Applies to 10 – 11.0)

In order to forward a domain blindly, you will create it in Plesk as you would any other domain, only select the Hosting Type as Forwarding, then select “Frame Forwarding” to spoof the domain name to your your domain name.

Domains > > Websites & Domains
Scroll to the bottom of the page and click the domain name
Locate the Hosting type and click ‘Change’
Now select Forwarding and Frame Forwarding.