I am trying to execute this code with nginx/php 7.3 / wordpress site on my raspberry pi
<code><?php
$output = shell_exec('v4l2-ctl -d /dev/video0 --list-formats-ext');
echo "<pre>$output</pre>";
?>
</code>
<code><?php
$output = shell_exec('v4l2-ctl -d /dev/video0 --list-formats-ext');
echo "<pre>$output</pre>";
?>
</code>
<?php
$output = shell_exec('v4l2-ctl -d /dev/video0 --list-formats-ext');
echo "<pre>$output</pre>";
?>
The problem is I get no answer If its called from wordpress site. If I manually run shell command
<code>pi@localhost:/var/www/html/wp-content/plugins/RPi/View/main_part $ php 1.php
</code>
<code>pi@localhost:/var/www/html/wp-content/plugins/RPi/View/main_part $ php 1.php
</code>
pi@localhost:/var/www/html/wp-content/plugins/RPi/View/main_part $ php 1.php
It works fine.
If I remove “-d /dev/video0 –list-formats-ext” and leave only v4l2-ctlit
<code><?php
$output = shell_exec('v4l2-ctl');
echo "<pre>$output</pre>";
?>
</code>
<code><?php
$output = shell_exec('v4l2-ctl');
echo "<pre>$output</pre>";
?>
</code>
<?php
$output = shell_exec('v4l2-ctl');
echo "<pre>$output</pre>";
?>
I get the correct answer on wordpress site (General/Common options list).
Any suggestions what am I doing wrong?