作者ZCBVXIRD (Alonso)
看板PHP
标题[请益] Win7 MAMP环境下做背景执行
时间Mon Sep 21 13:00:11 2015
各位大大好
前几天有问过背景执行的一下方法
目前是写了 sample.php sample_background.php
这两个来测试看行不行
code如下
[sample.php]
$cmd = "cmd /C D:\\software\\MAMP\\bin\\php\\php5.6.0\\php.exe
D:\\software\\MAMP\\htdocs\\test_background\\sample_background.php";
$WshShell = new COM("WScript.Shell");
$oExec = $WshShell->Run($cmd, 0, false);
[sample_background.php]
$file="sample_result.txt";
$fp = fopen($file,"a+");
fwrite($fp,"test OK! \r\n");
fclose($fp);
我从浏览器去开sample.php
希望能触发sample_background.php 来写入档案
但是都没有成功
但是把"cmd /C D:\\software\\MAMP\\bin\\php\\php5.6.0\\php.exe
D:\\software\\MAMP\\htdocs\\test_background\\sample_background.php"
这串复制到cmd内贴上跑 却是可以的,代表这串command应该是没有问题?
所以会是MAMP没有这些function吗?(要怎麽看有没有这些module?)
还是有其他问题呢?
谢谢!
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 42.73.12.179
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/PHP/M.1442811614.A.DB9.html
1F:推 hit1205: 看一下 php.ini 内有没启用 php_com_dotnet.dll ? 09/23 02:39
搜寻不到这个东西,在php的extention也没有这个东西@@
2F:推 wilson200106: 改用CURL驱动试试? 09/23 02:39
curl感觉是对某个php或html建立连线(HTTP polling)
这样有办法形成中断连线仍然在背景处理的效果吗?
(我想要的是让原本的index.php尽早结束跟客户端的polling,把工作丢给背景去做)
刚听hit大去看php.ini的同时
发现上次做的结果出现在MAMP的目录下@@
所以上次是成功的,只是路径不是出现在原本以为会出现的地方
(通常都是跟执行的php档在同目录下)
感谢两位大大回我XD
※ 编辑: ZCBVXIRD (42.72.252.179), 09/23/2015 12:59:22
※ 编辑: ZCBVXIRD (42.72.252.179), 09/23/2015 14:13:46
3F:推 rocairforce: gearman 09/23 14:46