I found a weird bug in python pyheif library. I am trying to run external python code in php function exec('python command', $output); I can get the python message in array with second argument $output from exec().
python code (test.py):
# -*- coding: utf-8 -*-
import sys
import os
import base64
from PIL import Image # pip3 install pillow
import pyheif # pip3 install pyheif
import io
print("hello world!")
php code (test.php):
<?php
exec("python3 test.py", $output);
var_dump($output);
This is working well on command line but not on the web browser. But when I remove import hyheif line or move print('hello world') ahead of hyheif line, it works both cli and web browser. I get the result: hello world string.
I got no clue. Does hyheic library cause this problem on the web browser while it works fine on the command line?
I need to import hyheic library for converting heic to jpeg on the browser. My problem is I am not able to get the result on php from python code.
When I import hyheif library, I get the following result:
shell:/var/www/myfolder$ php test.php
array(1) {
[0]=>
string(12) "hello world!"
}
on my chrome browser:
array(0){}