我有一个bash脚本foo.sh坐落在/etc/cron.daily目录,chmoded 700,属于root,root用户的crontab列表是不变的核心Debian安装(的crontab -l).我也以另一种方式比的crontab -l和/或crontab -e命令(例如,在特定的Debian的情况下,劝我没有重新启动与/etc/init.d/cron cron守护程序)运行的cronjob.尽管测试作业文件在类似条件下运行.该脚本已调试,可以作为独立任务运行,而不会返回错误.我还检查了日志(/ var/log/syslog)并且没有任何错误.
但是:这项特殊工作根本没有执行.
系统:Debian Lenny/Apache 2.2/php5.3.3源代码编译
我正在与php.ini中的date.timezone进行斗争.
我可以在php源代码中定义TZ,但我想在ini文件中立即修复它.
php代码:好的
date_default_timezone_set('Europe/Berlin');
Run Code Online (Sandbox Code Playgroud)
php.ini:如果没有在源代码中设置,则不予考虑
date.timezone = 'Europe/Berlin'
Run Code Online (Sandbox Code Playgroud)
我还检查了我修改了正确的php.ini文件并干扰了一些php.default.ini文件.
我在apache配置文件中检查了是否存在干扰TZ env数据,但没有.
不知道该怎么做,所以任何提示都会受到欢迎,
thx提前.
编辑:我也试过没有或单引号或双引号作为date.timezone ='Europe/Berlin',但我仍然在phpinfo中得到"无价值".
EDIT2:phpinfo()和下面的测试脚本都返回date.timezone为空(例如没有值):
date_default_timezone_set('America/Los_Angeles');
$script_tz = date_default_timezone_get();
$iniset = ini_get('date.timezone') ;
if (strcmp($script_tz, $iniset)){
echo "Script timezone ($script_tz) differs from ini-set timezone ($initset).";
} else {
echo "Script timezone ($script_tz) and ini-set timezone match.";
}
Run Code Online (Sandbox Code Playgroud)
编辑3:哼,我想我在php.ini中找到了sthg :
Configuration File (php.ini) Path : /usr/local/php533/php.ini
Loaded Configuration File : VOID !
Run Code Online (Sandbox Code Playgroud)
所以我必须找到确保Apache正在以某种方式寻找合适的php.ini的方法......
我在VM网络服务器中有很多重定向,当使用嵌入式导航器(iceweasel)浏览服务器时,它可以工作.但是当从托管计算机的浏览器访问服务器时(使用FF4/IE8/Chrome/Opera11测试),这不起作用.
所有经验丰富的重定向方法都在推动托管机器浏览器中的"服务器不可用或过载".
如果您可以查看apache日志中的标头并提供有关差异的一些提示(主要看起来是GET URL,只要相同的代码正在运行):
工作请求导致此日志:
cat /var/log/apache2/access.log | grep 127 | grep random | tail -n1
127.0.0.1 - authuserid [26/Jun/2011:11:11:52 +0200]
"GET /index.php?page=100 HTTP/1.1" 200 49151
"https://www.mydomain.foo/index.php?page=100&new_session=a4da9106dba2ffd40345a5eb624d7788&random=c0117685e7e65a307989c219efc587b4&sid=n7en2it41h2gumrcq3kmmil3c0&sidf=.ps_AWDkIY"
"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.19) Gecko/2011050718 Iceweasel/3.0.6 (Debian-3.0.6-3)"
Run Code Online (Sandbox Code Playgroud)
非工作请求导致此日志:
cat /var/log/apache2/access.log | grep 192 | grep random | tail -n1
www.mydomain.org:80 192.168.X.Y - authuserid [26/Jun/2011:11:08:07 +0200]
"GET /index.php?page=100&new_session=a4da9106dba2ffd40345a5eb624d7788&random=685de8bcd4d198d6ad7f3cf4b23de5b7 HTTP/1.1" 302 -
"http://www.mydomain.foo/index.php?page=xyz"
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"
Run Code Online (Sandbox Code Playgroud)
我无法显示标头响应,因为我没有收到响应,也没有apache报告的错误(loglevel = error).
谢谢
完成控制:
我增加了浏览器超时(FF:network.http.keep-alive.timeout到3600s:没有变化.
我检查过以前没有向重定向发送任何标头:ok( …
我有2个非常相似的函数,在将代码切换到Option Explicit调试目的(成功!)之前,这些函数已经起作用。从那时起,该Max功能不再起作用,并且我无法解释将其作为xl vba完美菜鸟解决的原因。
Max函数(不起作用):
Function MaxAddress(The_Range) As Variant
' See http://support.microsoft.com/kb/139574
Dim MaxNum As Variant
Dim cell As Range
' Sets variable equal to maximum value in the input range.
MaxNum = Application.Max(The_Range)
' Loop to check each cell in the input range to see if equals the
' MaxNum variable.
For Each cell In The_Range
If cell.Value = MaxNum Then
' If the cell value equals the MaxNum variable it
' returns …Run Code Online (Sandbox Code Playgroud)看起来javascript 开关案例不喜欢正则表达式作为一个案例,因为它适用于静态值,但我无法在case语句中使用正则表达式获得预期的答案.
您是否会确认js解释器的限制并提出解决方法(我的意思是不是if-then块套件)?
谢谢
示例(未给出预期答案,例如'case3'):
<script type="text/javascript">
var testme = "pwd_foo";
var response = false;
var reg = /^pwd.+/;
switch (testme) {
case 'pwd':
response = 'case1';
break;
case reg.test:
response = 'case2';
break;
case /^pwd.+/:
response = 'case3';
break;
default:
response = 'do sthg else';
}
alert('reg test: ' + reg.test(testme)+'\nresponse:' + response);
</script>
Run Code Online (Sandbox Code Playgroud) 我在Debian Lenny机器上有2个不同的Web服务器.一个运行FastCGI(TRAC),另一个Web服务器运行PHP和一些CGI脚本.所以我目前启用了2个Apache2模块(cgi和fcgi)以及相应的2个vhosts设置.我对这两个模块同时运行没有其他特别的兴趣.
所以我想保持只运行Apache fastcgi模块,因为它看起来更有效率.
您能否确认以下评估是对还是正确?
1-我将无法做什么/更改TRAC站点(已经运行fcgi)
2-我必须调整其他Web服务器vhost以使用fastcgi脚本的处理程序设置
3-我将只需要更改perl模块从"使用CGI"到"使用CGI :: Fast"
4-我将能够保留perl现有CGI脚本的其余部分
而不需要其他更改5-我不需要使用CGI :: Apache但CGI: :Web服务器脚本中的FastCGI(i/o当前CGI模块)
我希望我的观点很明确,因为它对我来说有点陌生......
谢谢
编辑:
thx为Naveed和J-16的提示,
这是我做的,如果它可以帮助其他人让它工作:
哼,用CPAN安装CGI :: Fast,然后它运行得更好..
在Debian上已经安装了libperl
perl -MCPAN -e shell
cpan> install CGI::Fast
Run Code Online (Sandbox Code Playgroud)将文件名从*.cgi更改为*.fcgi,
编辑:修改文件上传代码,因为初始脚本不再起作用(仍然不明白为什么),所以我不得不用这样一个替换while循环:
open(FILE,">$upload_dir/$file_name")
while ($bytes_count = read($file_query,$buffer,2096)) {
$size += $bytes_count;
print FILE $buffer;
}
close(FILE);
Run Code Online (Sandbox Code Playgroud)完成.
世界还不完美,但终于有效了.
回到这个线程,我正在努力解决如何从我的模块导出数据的方法.一种方法是工作,但不是我想要实现的另一种方式.
问题是为什么脚本中的第二种方法不起作用?(我没有h2xs模块,因为我猜这只是为了分发)
Perl 5.10/Linux发行版
模块 my_common_declarations.pm
#!/usr/bin/perl -w
package my_common_declarations;
use strict;
use warnings;
use parent qw(Exporter);
our @EXPORT_OK = qw(debugme);
# local datas
my ( $tmp, $exec_mode, $DEBUGME );
my %debug_hash = ( true => 1, TRUE => 1, false => 0, FALSE => 0, tmp=>$tmp, exec=>$exec_mode, debugme=>$DEBUGME );
# exported hash
sub debugme {
return %debug_hash;
}
1;
Run Code Online (Sandbox Code Playgroud)
脚本
#!/usr/bin/perl -w
use strict;
use warnings;
use my_common_declarations qw(debugme);
# 1st Method: WORKS
my %local_hash = &debugme; …Run Code Online (Sandbox Code Playgroud) 我想为主perl程序和其他包设置所有常见声明的专用包,而不是在每个头中重复这些声明.我肯定错了,但无法弄清楚背后的理由:
我们假设:
- 我已经在包my_common_declarations.pm中设置了我的公共数据.
- 我想在另一个包中使用这些数据, 例如my_perl_utils.pm.
#!/usr/bin/perl -w
package my_perl_utils;
use parent qw(Exporter);
our @EXPORT_OK = qw(f1 f2);
use my_common_declarations qw(debugme);
my %setup = &debugme;
my $DEBUGME = $setup{setup}{debugme};
# This generates this error : "Use of uninitialized value"
use constant true => $setup{setup}{'true'};
print "=" x25, "\nDEBUG true :\nimport = " . $setup{setup}{'true'} . "\nconstant = " , true , "\n", "=" x25, "\n";
sub f1{
# some rationals using the true or false …Run Code Online (Sandbox Code Playgroud) 我已经看到有一种非常方便的方法来反转ArrayList 像这里使用Collections.reverse()方法,但我需要为几种类型的原始对象(至少ArrayList和List我的自定义对象)实现这样的反向操作.因此Collections无法通过单一方法的延长使用来挽救我的生命.
到目前为止,我设法让stg工作(参见下面的代码),但我必须写两次:一次用于ArrayList,一次用于List.我把它们命名为相同,所以使用非常方便,但有些..优化会更方便:-).
如何将这两种方法共同化为单一(真实)通用方法?
谢谢
/**
* Generic Reverse Method for ARRAYLIST using Iterator
* @param ArrayList<Obj_item> notReversed
* @return ArrayList<Obj_item> reversed
*/
@SuppressWarnings("unchecked")
public static <Obj_item> ArrayList<Obj_item> GenReverseArrayByIterator(ArrayList<Obj_item> mylist) {
// ^^^^^^^^^^^^^^^^^^ how to make this generic ?
// Instanciate
ArrayList<Obj_item> tmp = new ArrayList<Obj_item>();
ArrayList<Obj_item> reversed = new ArrayList<Obj_item>();
// Copy original list
tmp = mylist;
// Generate an iterator, starting right after the last element.
@SuppressWarnings("rawtypes")
ListIterator …Run Code Online (Sandbox Code Playgroud) perl ×3
php ×2
android ×1
apache ×1
arrays ×1
case ×1
cgi ×1
constants ×1
crontab ×1
date ×1
debian ×1
declaration ×1
excel ×1
excel-vba ×1
exporter ×1
fastcgi ×1
header ×1
html ×1
java ×1
javascript ×1
linux ×1
module ×1
package ×1
redirect ×1
regex ×1
reverse ×1
shared ×1
timezone ×1
upload ×1
vba ×1