0

最近我在家里安装了带有 Ubuntu OS 和 XAMPP 的小型服务器。现在我有了简单的基于 PHP 的界面,可以将 PDF 文件上传到服务器并运行 shell 脚本从中提取页面。它可以在我的本地网络(通过本地 IP 访问)、家庭互联网(通过外部 IP 访问)甚至通过 android 手机(通过外部 IP)的移动互联网上完美运行。但无论是从我的工作互联网,还是从我妻子的工作互联网(最重要的),它都不起作用。

问题是文件无法上传。网页只是无限“思考”,没有报错,我什至不知道该从哪里挖,该怪谁。脚本的其余部分适用于已上传的 PDF 文件。

请帮忙,至少我应该从哪里开始寻找?

这是PHP脚本的一部分(不确定是否有帮助):

if(isset($_POST["act"])) {
    if($_POST["act"]=="get"){
        if(isset($_FILES["upl"])&&$_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"])&&$_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");
            }
        }
    }
}

文件上传部分php.ini

file_uploads=On
upload_tmp_dir="/opt/lampp/temp/"
upload_max_filesize=128M

文件夹的权限temp是 777。

HTML 表单数据:

<form action="procc.php" method="post" enctype="multipart/form-data">
<div>Choose uploaded file or upload a new one:</div>
<div style="width: 400px; height: 200px; border: 1px solid black; overflow-y: scroll;">
<table width="100%">
<tr><td><div><label><input onchange="chfile(this.value)" type="radio" name="file" value="1.Вентиляторы.pdf" />1.Вентиляторы.pdf</label></div></td><td><a target="_blank" href="pdfs/1.Вентиляторы.pdf">[open]</a></td></tr>
</table>
</div>
<div>Upload new PDF file: <span style="border: 1px solid black;"><input type="file" name="upl" accept="application/pdf" /></span><br />
(If both [new file to upload] and [file from list] is set, then file from list will be ignored)
</div>
<hr width="400" align="left" />
<div>Chosen file (from list): <span id="chosen"></span></div>
<div>First and last page: <input type="text" size="4" name="fp" /> - <input type="text" size="4" name="lp" /></div>
<div>New filename: <input type="text" size="10" name="nname" /></div>
<div>(last field can be ignored, in this case name will be based on the original filename)</div>
<div><button name="act" value="ext">Extract pages</button></div>
</form>

error_logApache重启文件:

[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'

我已经在我的服务器上打开了所有端口 (1-65535),现在它在我工作场所的网络上运行良好,但我不太喜欢这个解决方案。有人可以给我一个关于哪些端口保持开放的建议吗?在此之前,我打开了四个端口:用于 HTTP、SSH 和两个用于 FTP。

4

0 回答 0