title: Can't upload files to home server from some computers
body: <p>Recently I've installed small server at home with Ubuntu OS and XAMPP. Now I have simple PHP-based interface to upload PDF files to server and run shell script to extract pages from it. It works perfectly from my local network (access by local IP), from home internet (access by external IP) and even from mobile internet via android phone (by external IP). But it doesn't work neither from my work internet, nor from my wife's work internet (the most important).</p>
  
  <p>The problem is file cannot be uploaded. Web page just "thinks" infinitely, no errors is reporting, I don't even know where to dig and who to blame. The rest of the script works fine with already uploaded PDF files.</p>
  
  <p>Please help, at least where I should start looking?</p>
  
  <p>Here is part of PHP script (don't sure if it will help):</p>
  
  <pre><code>if(isset($_POST["act"])) {
      if($_POST["act"]=="get"){
          if(isset($_FILES["upl"])&amp;&amp;$_FILES["upl"]["name"]!=""){
              if(getExt($_FILES["upl"]["name"])!=="pdf") {
                  $err=1;
              }
              else {
                  if(move_uploaded_file($_FILES["upl"]["tmp_name"],"pdfs/".$_FILES["upl"]["name"])) $file=$_FILES["upl"]["name"];
                  else $err=2;
              }
          } elseif(isset($_POST["file"])) {
              if(file_exists("pdfs/".$_POST["file"])) $file=$_POST["file"];
              else $err=3;
          }
          if($file) {
              if(!isset($_POST["fp"],$_POST["lp"])||!is_int((int) $_POST["fp"])||!is_int((int) $_POST["lp"])) {
                  $err=4;
              } else {
                  $pg=array($_POST["fp"],$_POST["lp"]);
                  if(isset($_POST["nname"])&amp;&amp;$_POST["nname"]!="") {
                      $output=$_POST["nname"];
                      if(getExt($output)!=="pdf")$output.=".pdf";
                  } else {
                      $exts=getExt($file,"");
                      $output=$exts[1]."_($pg[0]-$pg[1]).".$exts[0];
                  }
                  $doGS="./gs.sh \"pdfs/$file\" \"pdfs1/$output\" $pg[0] $pg[1]";
                  $doGS=`$doGS`;
                  if(file_exists("pdfs1/".$output)) header("location: result.php?res=$output");
              }
          }
      }
  }
  </code></pre>
  
  <p>File Uploads section in <code>php.ini</code>:</p>
  
  <pre><code>file_uploads=On
  upload_tmp_dir="/opt/lampp/temp/"
  upload_max_filesize=128M
  </code></pre>
  
  <p>Permissions to <code>temp</code> folder is 777.</p>
  
  <p>HTML form data:</p>
  
  <pre><code>&lt;form action="procc.php" method="post" enctype="multipart/form-data"&gt;
  &lt;div&gt;Choose uploaded file or upload a new one:&lt;/div&gt;
  &lt;div style="width: 400px; height: 200px; border: 1px solid black; overflow-y: scroll;"&gt;
  &lt;table width="100%"&gt;
  &lt;tr&gt;&lt;td&gt;&lt;div&gt;&lt;label&gt;&lt;input onchange="chfile(this.value)" type="radio" name="file" value="1.Вентиляторы.pdf" /&gt;1.Вентиляторы.pdf&lt;/label&gt;&lt;/div&gt;&lt;/td&gt;&lt;td&gt;&lt;a target="_blank" href="pdfs/1.Вентиляторы.pdf"&gt;[open]&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;div&gt;Upload new PDF file: &lt;span style="border: 1px solid black;"&gt;&lt;input type="file" name="upl" accept="application/pdf" /&gt;&lt;/span&gt;&lt;br /&gt;
  (If both [new file to upload] and [file from list] is set, then file from list will be ignored)
  &lt;/div&gt;
  &lt;hr width="400" align="left" /&gt;
  &lt;div&gt;Chosen file (from list): &lt;span id="chosen"&gt;&lt;/span&gt;&lt;/div&gt;
  &lt;div&gt;First and last page: &lt;input type="text" size="4" name="fp" /&gt; - &lt;input type="text" size="4" name="lp" /&gt;&lt;/div&gt;
  &lt;div&gt;New filename: &lt;input type="text" size="10" name="nname" /&gt;&lt;/div&gt;
  &lt;div&gt;(last field can be ignored, in this case name will be based on the original filename)&lt;/div&gt;
  &lt;div&gt;&lt;button name="act" value="ext"&gt;Extract pages&lt;/button&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p><code>error_log</code> file on Apache reboot:</p>
  
  <pre><code>[Wed Oct 23 20:03:31.064659 2013] [mpm_prefork:notice] [pid 2339] AH00169: caught SIGTERM, shutting down
  [Wed Oct 23 20:03:38.243555 2013] [ssl:warn] [pid 2857] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
  [Wed Oct 23 20:03:38.243843 2013] [ssl:warn] [pid 2857] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
  [Wed Oct 23 20:03:38.243957 2013] [suexec:notice] [pid 2857] AH01232: suEXEC mechanism enabled (wrapper: /opt/lampp/bin/suexec)
  [Wed Oct 23 20:03:38.625858 2013] [auth_digest:notice] [pid 2858] AH01757: generating secret for digest authentication ...
  [Wed Oct 23 20:03:39.123570 2013] [ssl:warn] [pid 2858] AH01906: RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
  [Wed Oct 23 20:03:39.123708 2013] [ssl:warn] [pid 2858] AH01909: RSA certificate configured for www.example.com:443 does NOT include an ID which matches the server name
  [Wed Oct 23 20:03:39.123844 2013] [lbmethod_heartbeat:notice] [pid 2858] AH02282: No slotmem from mod_heartmonitor
  [Wed Oct 23 20:03:39.157999 2013] [mpm_prefork:notice] [pid 2858] AH00163: Apache/2.4.4 (Unix) OpenSSL/1.0.1e PHP/5.5.3 mod_perl/2.0.8-dev Perl/v5.16.3 configured -- resuming normal operations
  [Wed Oct 23 20:03:39.158180 2013] [core:notice] [pid 2858] AH00094: Command line: '/opt/lampp/bin/httpd -E /opt/lampp/logs/error_log -D SSL -D PHP'
  </code></pre>
  
  <p>I've opened all ports (1-65535) on my server, and now it works fine from my workplace's network, but I don't really like this solution. Can someone give me an advice on which ports to keep opened?
  Before now I had four ports opened: for HTTP, SSH and two for FTP.</p>