mysqldump切断了新的apache升级

So I have inventory on a web site. I transfer inventory from my local computer, to my hosted website every day, to keep it up to date. So I am basically making changes on my local computer, and then letting all the updates go live every night by using mysqldump to grab the inventory. I used to have my web site on shared hosting and it worked great. The site kept having downtime, so I tried to upgrade to Bluehost's VPS server. Well now the server I'm on is configured differently and the dump is no longer working.

Here is what happens: The dump runs about 25% of the way, and then quits. Out of 40k inventory items, it only uploads 9-11k each time I try. Leads me to think there's either a timeout issue, or a data size issue. The whole process used to upload in 1 minute, and now quits in about 20 seconds.

What I've already tried is changing the mysql config file my.cnf file by adding these lines:

net_read_timeout = 7200
net_write_timeout = 7200

And here's my Code:

<?php
ini_set('max_execution_time', 0);
set_time_limit(0);
ini_set('set_memory_limit', -1);
ini_set('display_errors', 1); 
error_reporting(E_ALL);

include "globe/globalvariables.php";

$output = exec(
"mysqldump -h ".$local_business_ip.
" -u".$local_business_db_admin_login.
" -p".$local_business_db_admin_password.
" ".$local_business_inventory_db_name.
" ".$local_business_inventory_table_name." | mysql -h ".$web_db_host.
" -u".$web_db_admin_login.
" -p".$web_db_admin_password.
" ".$web_db_name);

echo "done";
?>

I have also tried changing the first line of the exec to:

 mysqldump nohup -h ".$local_business_ip.

But the nohup simply makes it skip the whole operation as if its a bad command or something.

I've also tried shell_exec, system, and pass_thru or passthru. I've also upgraded the MYSQL to 5.6 on the server.

I've searched for answers for two days. Any body have a clue what I can do? I believe it's some apache configuration problem. By the way, I'm on Bluehost VPS server with a WHM. And NO bluehost is not helpful at all! They didn't tell me either, that the config will be reset or whatever.

I found this in the PHP manual:

_"The set_time_limit() function and the configuration directive max_execution_time_ only affect the execution time of the script itself. Any time spent on activity that happens outside the execution of the script such as system calls using system(), stream operations, database queries, etc. is not included when determining the maximum time that the script has been running. This is not true on Windows where the measured time is real."

Not sure HOW to make exec and system functions time limit higher?

So I'm a newb, but I found where the apache error log was and I saw this error: mod_fcgid: read data timeout in 40 seconds, ...

after looking up the error on google, this site helped!

http://blog.secaserver.com/2011/07/cpanel-apache-php-fastcgi-data-timeout-error

This is from that site: *If you are run on cPanel server and have FastCGI enabled in Apache, you might facing following error which caused your website hang or prompting ’500 Internal Server Error’ message. When checking into /etc/httpd/log/error_log, you will see something similar as below:

[warn] .. mod_fcgid: read data timeout in 40 seconds, ... [error] .. Premature end of script headers: index.php ...

This is because mod_fcgid has reached the timeout in processing the parse data. So we need to increase some of the respective value:

  1. Login to WHM > Apache Configuration > Include Editor > Post VirtualHost Include > All

  2. Copy and paste following code: FcgidProcessLifeTime 8200 FcgidIOTimeout 8200 FcgidConnectTimeout 400 FcgidMaxRequestLen 1000000000

  3. restart apache*