'When I'am Run PHP Exec Always Return Code 1
I'am currently try a YoloV5 you can see here, and here i'am try to run detect.py using php exec this is my code
<?php
$yolo_dir = "/var/www/yolov5";
$upload_tujuan = "/var/www/gambar";
$detect_file = $yolo_dir . '/detect.py';
$model_path = "/var/www/yolov5/runs/train/exp/weights/best.pt";
$nama = time() . '_' . $_FILES['file']['name'];
$file_tmp = $_FILES['file']['tmp_name'];
$full_file_path = $upload_tujuan . DIRECTORY_SEPARATOR . $nama;
$moved = move_uploaded_file($file_tmp, $full_file_path);
$hasil_eksekusi = exec("/usr/bin/python3 " . $detect_file ." --weights ". $model_path ." --img 416 --conf 0.1 --source ". $full_file_path ." --exist-ok", $output, $error);
print_r($output);
print_r($error);
but after i run thats command the results always return code 1. I'am use apache as web server PHP 7.4. And i was read this solution, i'am can't understand it. Anyone can help me please?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
