English 中文(简体)
B. 在背景中处理购买力平价
原标题:Getting PHP processing to happen in the background

我正在开发一个PHP网站,我正在将其转移到一个新的服务器上。 我正在搬进的新服务器没有CRON兼容。 为了弥补这一缺陷,我设计了一个使用时间格式和数据库表格的系统,而且有更多的系统来管理我的代码。

我所面对的问题是:

if ($lasttime < $pretime)
{
    $newtime = strtotime("now");

    queryMysql("UPDATE time SET time=".$newtime." WHERE time=".$lasttime);

    include_once  grabber/grabber.php ;
}

具体来说,它有:include_once grabber/grabber.php;,造成这一问题。 当行车时,该法典的行程和行程时,该法典便被包括在其中,然后该法典的停下来,没有提供错误,因此包括失败。 我尝试将其改为exec(),但坦率地说,我并不完全理解exec(<>的操作,如果是正确的话。 这就是我如何利用这一工具:

if ($lasttime < $pretime)
{
    $newtime = strtotime("now");

    queryMysql("UPDATE time SET time=".$newtime." WHERE time=".$lasttime);

    $grabber = $base."grabber/grabber.php";    

    exec($grabber);
}

This does not stop the code and seems to run but it doesn t actually work, if grabber/grabber.php runs correctly then I get an email to confirm using the PHP mail() function

If anyone could help me solve this or shed some light that would be brilliant. Thanks.

最佳回答

这很可能是档案地点或许可的问题。 应存在某种错误,或该守则没有停止,但你没有适当检查,或者在<条码>格拉贝.php<<<>>>>上存在某种问题。 本身。 添加一些条形线——打印文档名称,以便你能够检查道路/名称中的错误;添加<代码>error_ reporting(E_ALL);不一(显示器,真实);在<条码>前面的其他地方:include_once;确保文件能够考虑到相对途径,重新开放。 确保你获准管理这一档案。

这里并非你所需要的,至少不是你试图使用它的方式。

如果这无助的话,请提供更多资料,说明你如何操作你所展示的文字,什么是<代码>grabber。 php file, what original submissions, et al.

问题回答

(假设你的服务器为*nix) 如果你想要使用<代码>exec(>>,你需要把hashbang放在说明公共卫生和社会福利部可执行并给予其执行许可的上。

或(这可能是更好/更可行的办法),变化

$grabber = $base."grabber/grabber.php";    
exec($grabber);

纽约总部

$grabber = "php ".$base."grabber/grabber.php";    
exec($grabber);

......你们从一个终点站开车。

However, I doubt this will solve the problem - I think the answer is more likely 纽约总部 be one of these things:

  • A parse error in grabber.php. Keep in mind that there are slight syntax differences between major PHP versions - if your PHP version is different on your old/new hosts, this may be the problem.
  • A call 纽约总部 a function that was defined on your old host but not on your new host, because of a difference in PHP version or installed extensions
  • grabber.php was corrupted during the move between servers

Try it with the include_once, but do ini_set( display_errors ,1); error_reporting(-1); 纽约总部 make sure you actually see any errors. How are you calling you main script? How will you see the errors? Edit the question with this info, any code from grabber.php you think may be relevant and I will expand this answer.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签