proc_open()fork在Laravel控制器中失败
我收到一个错误,提示:proc_open()fork在Laravel控制器中失败,laravel,asynchronous,php-7,Laravel,Asynchronous,Php 7,我收到一个错误,提示:proc\u open():fork失败-无法在Laravel控制器中分配内存。使用axios(Vuejs SAP)调用generate函数 这就是我的控制器的样子 use Illuminate\Http\Request; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\Storage; use GifCreator\AnimGif; use simpleimage\SimpleImage;
proc\u open():fork失败-无法在Laravel控制器中分配内存。使用axios(Vuejs SAP)调用generate
函数
这就是我的控制器的样子
use Illuminate\Http\Request;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use GifCreator\AnimGif;
use simpleimage\SimpleImage;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
class GifController extends Controller
{
//
public function generate(Request $request)
{
if(!$request->ajax()) return;
$cmd = 'ls';
$process = new Process($cmd);
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo $process->getOutput();
}
}
free-m
在服务器上:
| | total | used | free | shared | buff/cache | available |
| ----- | ------ | ----- | ---- | ------ | ---------- | --------- |
| Mem: | 2000 | 243 | 577 | 20 | 1178 | 1541 |
| Swap: | 4095 | 0 | 4095 | | | |
编辑:
正如Hilmi指出的那样,我现在尝试添加交换空间,现在命令成功运行了,有时是——大约一半的时间
如果该过程失败,是否有办法重试?服务器中是否有足够的可用ram?你试过创建交换文件吗?我已经用内存信息更新了帖子