小编Sur*_*esh的帖子

wget:无法打开文件

我已经配置apache2并且工作正常 - 当http://localhost/从浏览器访问时,我得到了对浏览器的正确响应。

但是,当我从该服务器远程登录到其中一个客户端并http://webserverIP在命令行中尝试 wget 时,我收到此错误 - wget: 无法打开 'index.html': 文件存在

从 telnet 中,我可以看到,客户端可以成功 ping 服务器。奇怪的是在 access.log 中,我可以看到 wget 命令的响应代码 200。

拥有index.html所有权限(chmod 777)。

谁能告诉我为什么我收到错误?

wget apache2

5
推荐指数
2
解决办法
1万
查看次数

无法将http请求标头写入perl中的文件

我正在尝试将HTTP标头从请求写入文件.单独执行的perl脚本运行正常并写入文件.但是当我从http请求调用脚本时,我收到http 500错误并且错误日志说..'无法打开文件'我在脚本中评论了"打开文件"行,并且从浏览器调用时它完全正常.请告诉我我在这里做错了什么?以下是代码:

#!/usr/bin/perl  
use CGI qw(:standard); 
use strict; 
use warnings; 
use Carp; 
use LWP::Simple; 
my $query = CGI->new; 
my $file = '/home/suresh/clientrequest.txt'; 
chmod 644, $file; 
sleep(1); 
open my $flh, '+>>', "$file" or die "Cannot open file"; 
$flh->autoflush(); 
# Read the data here 
print $flh my @keywords = $query->keywords; 
print $flh $query->header(-domain=>'testdomain'); 
print $flh my @names= $query->param; 
close $flh; 
print header; 
print start_html("Welcome"); 
print $ENV{QUERY_STRING}; 
print end_html;
Run Code Online (Sandbox Code Playgroud)

perl cgi http apache2

2
推荐指数
1
解决办法
246
查看次数

发送404状态但浏览器在客户端显示500错误

我试图根据IF条件发送http 404状态代码.但是,在客户端我看到http 500错误.在我的apach2错误日志中,我看到格式错误的标题.看了很多次我的代码,我无法弄清楚出了什么问题!任何人都可以建议我如何向客户发送404消息?

以下是我的perl代码:

#!/usr/bin/perl

use CGI qw(:standard);
use strict;
use warnings;
use Carp;
use File::Copy qw( copy );
use File::Spec::Functions qw( catfile );
use POSIX qw(strftime);
use Time::Local;
use HTTP::Status qw(:constants :is status_message);
use Digest::MD5 qw(md5 md5_hex md5_base64);
use File::Basename;
use URI;



my $extfile = '/home/suresh/clientrequest.txt';
open(FH, ">>$extfile") or die "Cannot open file";
my $query = CGI->new;
my $stcode = status_message(200);
my $uri =$ENV{'REQUEST_URI'};
my $rdate =strftime("%a, %d %b %Y %H:%M:%S %Z", localtime());
print FH "Got Following Headers:\n";
print …
Run Code Online (Sandbox Code Playgroud)

perl cgi apache2 http-status-codes

0
推荐指数
1
解决办法
831
查看次数

标签 统计

apache2 ×3

cgi ×2

perl ×2

http ×1

http-status-codes ×1

wget ×1