title: Mysterious 503 Error with PHP/MySQL File/Database Sync
body: <p>I am hoping you all can help me out a little. I have spent about 7 hours trying to find an answer and have tried many things so far.</p>
  
  <p>I have a PHP script that is used to sync files/database data between 2 servers. Before you guys ask this process is necessary for this project and must stay in place. </p>
  
  <p>The script basically finds all files in a directory that have changed in the last 72 hours and SFTPs them to the other server, replacing any files needed. It then creates a copy of the backing database, removes certain tables/rows, changes others and exports a .sql file. It then SFTPs this .sql file to the other server and calls an include on a file on the 2nd server that imports the .sql file replacing the existing database with updated data.</p>
  
  <p>All of this works...</p>
  
  <p>The issue is that no matter what changes I make to the Apache config the script always gives me a 503 error after 30 seconds, every time (between 30.02 and 30.04 seconds to be precise). However, the PHP script continues to run and successfully completes all operations, including writing to the log file, in about 60-61 seconds. There is nothing in the Apache logs referencing any kind of error at all either. </p>
  
  <p>I have checked all .conf files used and none of them mention a 30 second timeout. In my httpd.conf I have added these lines:</p>
  
  <pre><code>TimeOut 300
  ProxyTimeOut 300
  KeepAlive On
  KeepAliveTimeout 60
  </code></pre>
  
  <p>I also have set the max_execution_time and memory_limit on the php script to 120 and 2048M, respective, to be sure to rule that out during testing.</p>
  
  <p>The page is supposed to display a success message to the user with a report of what was changed/updated. However with the 503 error I am not able to do this. So I am looking to get rid of this 503 limitation so it can properly display the end result of the sync. I am not <em>too</em> familiar with Apache configuration to be honest so any help/ideas on what would cause this/where to look would be <strong>much</strong> appreciated!</p>
  
  <p>Thanks in advance!</p>